Bug#1055616: ansible-core: ansible.builtin.setup does not include facts from facter.

2023-11-10 Thread Lee Garrett

Hi Andy,

On 10.11.23 20:31, andrew bezella wrote:

On Fri, 2023-11-10 at 12:39 +0100, Lee Garrett wrote:

Hi Andrew,


hello -


On 08.11.23 22:40, andrew bezella wrote:


[...]
i was eventually able to build an updated version of bookworm's
ansible-core .deb including commit id 4b0d014.  this task was made
more difficult by the current FTBFS status of ansible-core but the
patch allowed ansible.builtin.setup to include facts from facter:


Can you elaborate please? AFAICS ansible-core builds fine in stable
and sid.


it wouldn't build in pbuilder and it shows up on the "Packages in
bookworm/amd64 which failed to build from source" page[1].  but from
the changelog it looks like you found and fixed the locale issue that i
was running up against:
ERROR: Ansible requires the locale encoding to be UTF-8; Detected None.


Indeed! I didn't notice it before because the reproducible build daemons 
apparently set a different locale than the regular build daemons. But it should 
be fixed now.




i spent a bunch of time fiddling w/pbuilder to find the "right" answer
but eventually just brute-forced it[2].  your solution is much better!

thank you for the prompt turnaround.  i would suggest/ask that the
facter fix be included in bookworm, too; the lack of expected facts can
have unexpected and significant impact on a playbook's run.


I'm working on the upload right now. It should hopefully be available in 
bookworm-proposed-updates in the next few days.




thanks again!

andy

1. https://tests.reproducible-builds.org/debian/bookworm/amd64/index_FTBFS.html
2. https://bugs.launchpad.net/ubuntu/+source/pbuilder/+bug/1947424/comments/10



Greetings,
Lee



Bug#1055616: ansible-core: ansible.builtin.setup does not include facts from facter.

2023-11-10 Thread andrew bezella
On Fri, 2023-11-10 at 12:39 +0100, Lee Garrett wrote:
> Hi Andrew,

hello -

> On 08.11.23 22:40, andrew bezella wrote:
> 
> > [...]
> > i was eventually able to build an updated version of bookworm's
> > ansible-core .deb including commit id 4b0d014.  this task was made
> > more difficult by the current FTBFS status of ansible-core but the
> > patch allowed ansible.builtin.setup to include facts from facter:
> 
> Can you elaborate please? AFAICS ansible-core builds fine in stable
> and sid.

it wouldn't build in pbuilder and it shows up on the "Packages in
bookworm/amd64 which failed to build from source" page[1].  but from
the changelog it looks like you found and fixed the locale issue that i
was running up against:
   ERROR: Ansible requires the locale encoding to be UTF-8; Detected None.

i spent a bunch of time fiddling w/pbuilder to find the "right" answer
but eventually just brute-forced it[2].  your solution is much better!

thank you for the prompt turnaround.  i would suggest/ask that the
facter fix be included in bookworm, too; the lack of expected facts can
have unexpected and significant impact on a playbook's run.

thanks again!

andy

1. https://tests.reproducible-builds.org/debian/bookworm/amd64/index_FTBFS.html
2. https://bugs.launchpad.net/ubuntu/+source/pbuilder/+bug/1947424/comments/10

-- 
andrew bezella 
internet archive



Bug#1055616: ansible-core: ansible.builtin.setup does not include facts from facter.

2023-11-10 Thread Lee Garrett

Hi Andrew,

On 08.11.23 22:40, andrew bezella wrote:

Package: ansible-core
Version: 2.14.3-1
Severity: normal

Dear Maintainer,

i installed ansible-core and facter 4.3.0-2 in bookworm.  when testing
i found that the facts from facter were not being included by the
setup module:

% ansible -b localhost -m ansible.builtin.setup -a 'filter=facter_*'
[WARNING]: No inventory was parsed, only implicit localhost is available
localhost | SUCCESS => {
 "ansible_facts": {},
 "changed": false
}

this issue has appeared upstream and was resolved by:
setup module, retry facter to handle --puppet errors by bcoca · Pull Request 
#80645 · ansible/ansible · GitHub
https://github.com/ansible/ansible/pull/80645


Thank you for the bug report! I've been able to reproduce the bug and will 
prepare an upload for sid and bookworm shortly.




i was eventually able to build an updated version of bookworm's
ansible-core .deb including commit id 4b0d014.  this task was made
more difficult by the current FTBFS status of ansible-core but the
patch allowed ansible.builtin.setup to include facts from facter:


Can you elaborate please? AFAICS ansible-core builds fine in stable and sid.



% ansible -b localhost -m ansible.builtin.setup -a 'filter=facter_*'
[WARNING]: No inventory was parsed, only implicit localhost is available
localhost | SUCCESS => {
 "ansible_facts": {
 "facter_disks": {
 "sda": {
[...]
 "facter_timezone": "UTC",
 "facter_virtual": "physical"
 },
 "changed": false
}

thanks in advance for addressing this.

andy



Greetings,
Lee



Bug#1055616: ansible-core: ansible.builtin.setup does not include facts from facter.

2023-11-08 Thread andrew bezella
Package: ansible-core
Version: 2.14.3-1
Severity: normal

Dear Maintainer,

i installed ansible-core and facter 4.3.0-2 in bookworm.  when testing
i found that the facts from facter were not being included by the
setup module:

% ansible -b localhost -m ansible.builtin.setup -a 'filter=facter_*'
[WARNING]: No inventory was parsed, only implicit localhost is available
localhost | SUCCESS => {
"ansible_facts": {},
"changed": false
}

this issue has appeared upstream and was resolved by:
setup module, retry facter to handle --puppet errors by bcoca · Pull Request 
#80645 · ansible/ansible · GitHub
https://github.com/ansible/ansible/pull/80645

i was eventually able to build an updated version of bookworm's
ansible-core .deb including commit id 4b0d014.  this task was made
more difficult by the current FTBFS status of ansible-core but the
patch allowed ansible.builtin.setup to include facts from facter:

% ansible -b localhost -m ansible.builtin.setup -a 'filter=facter_*'
[WARNING]: No inventory was parsed, only implicit localhost is available
localhost | SUCCESS => {
"ansible_facts": {
"facter_disks": {
"sda": {
[...]
"facter_timezone": "UTC",
"facter_virtual": "physical"
},
"changed": false
}

thanks in advance for addressing this.

andy


-- System Information:
Debian Release: 12.2
  APT prefers stable-updates
  APT policy: (500, 'stable-updates'), (500, 'stable-security'), (500, 'stable')
Architecture: amd64 (x86_64)

Kernel: Linux 6.1.0-13-amd64 (SMP w/64 CPU threads; PREEMPT)
Kernel taint flags: TAINT_PROPRIETARY_MODULE, TAINT_OOT_MODULE, 
TAINT_UNSIGNED_MODULE
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE not set
Shell: /bin/sh linked to /usr/bin/dash
Init: systemd (via /run/systemd/system)

Versions of packages ansible-core depends on:
ii  openssh-client1:9.2p1-2+deb12u1
ii  python3   3.11.2-1+b1
ii  python3-cryptography  38.0.4-3
ii  python3-distutils 3.11.2-3
ii  python3-dnspython 2.3.0-1
ii  python3-httplib2  0.20.4-3
ii  python3-jinja23.1.2-1
ii  python3-netaddr   0.8.0-2
ii  python3-packaging 23.0-1
ii  python3-paramiko  2.12.0-2
ii  python3-pycryptodome  3.11.0+dfsg1-4
ii  python3-resolvelib0.9.0-2
ii  python3-yaml  6.0-3+b2

Versions of packages ansible-core recommends:
ii  ansible  7.3.0+dfsg-1
pn  python3-argcomplete  
pn  python3-jmespath 
pn  python3-kerberos 
pn  python3-libcloud 
ii  python3-selinux  3.4-1+b6
pn  python3-winrm
pn  python3-xmltodict

Versions of packages ansible-core suggests:
pn  cowsay   
pn  sshpass  

-- no debconf information
>From 4b0d014d5840333457bd118c5fae5cf58325a877 Mon Sep 17 00:00:00 2001
From: Brian Coca 
Date: Mon, 8 May 2023 16:53:53 -0400
Subject: [PATCH] setup module, retry facter to handle --puppet errors (#80645)

* setup module, retry facter to handle --puppet errors

facter versions have changed how they deal with the --puppet flag
when puppet is not present, most versions will just ignore it and not error,
but initial versions of facter 4 changed the behaviour (later reverted).

fixes #80496
---
 changelogs/fragments/setup_facter_fix.yml |  2 ++
 .../module_utils/facts/other/facter.py| 23 +++
 2 files changed, 10 insertions(+), 15 deletions(-)
 create mode 100644 changelogs/fragments/setup_facter_fix.yml

diff --git a/changelogs/fragments/setup_facter_fix.yml 
b/changelogs/fragments/setup_facter_fix.yml
new file mode 100644
index 00..78a6b005a4abf2
--- /dev/null
+++ b/changelogs/fragments/setup_facter_fix.yml
@@ -0,0 +1,2 @@
+bugfixes:
+  - setup module (fact gathering) will now try to be smarter about different 
versions of facter emitting error when --puppet flag is used w/o puppet.
diff --git a/lib/ansible/module_utils/facts/other/facter.py 
b/lib/ansible/module_utils/facts/other/facter.py
index 3f83999d419d5c..063065251dd36e 100644
--- a/lib/ansible/module_utils/facts/other/facter.py
+++ b/lib/ansible/module_utils/facts/other/facter.py
@@ -1,17 +1,5 @@
-# This file is part of Ansible
-#
-# Ansible is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Ansible is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with Ansible.  If not, see .
+# Copyright (c) 2023 Ansible Project
+# GNU General Public License v3.0+ (see COPYING or 
https://www.gnu.org/licenses/gpl-3.0.txt)
 
 from __future__ import (absolute_import, division, print_function)