-
Notifications
You must be signed in to change notification settings - Fork 23.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ansible_pkg_mgr is "unknown" on OpenBSD since 2.4 #30623
Comments
cc @alikins |
@sparunakian What does the 'ansible_system' fact end up being set to? The pkg_mgr fact collection code has a special case for ansible_system='OpenBSD' to set pkg_mgr='openbsd_pkg' If you can provide the full output of 'ansible openbsd_machine -m setup.py' (all of the facts without filters) that may be useful. When you use the 'package' module, how does it fail? If possible, please provide a copy of the output from running with verbosity set to '-vvv' or higher (either 'ansible' or 'ansible-playbook' against a host showing the problem, whichever is easier) |
My suspicion is this is related to the order the facts are collected in, and that 'ansible_system' may not be known when the pkg_mgr fact is collected. There is currently no explicit partial ordering for the facts collection so the ordering may be random which could cause the 'ansible_system' to be unknown when pkg_mgr is determined. If thats the case, I need to go ahead and implement some ordering to the collectors to generally fix this. |
also dependencies, since now you can avoid collecting 'platform' information |
this allows for proper dependencies on facts already collected fixes ansible#30753 fixes ansible#30623
* Fix pkg_mgr fact on OpenBSD Add a OpenBSDPkgMgrFactCollector that hardcodes pkg_mgr to 'openbsd_pkg'. The ansible collector will choose the OpenBSD collector if the system is OpenBSD and the 'Generic' one otherwise. This removes PkgMgrFactCollectors depenency on the 'system' fact being in collected_facts, which also avoids ordering issues (if the pkg mgr fact is collected before the system fact...) Fixes #30623 (cherry picked from commit 12404f4)
* Fix pkg_mgr fact on OpenBSD Add a OpenBSDPkgMgrFactCollector that hardcodes pkg_mgr to 'openbsd_pkg'. The ansible collector will choose the OpenBSD collector if the system is OpenBSD and the 'Generic' one otherwise. This removes PkgMgrFactCollectors depenency on the 'system' fact being in collected_facts, which also avoids ordering issues (if the pkg mgr fact is collected before the system fact...) Fixes #30623
Thank you for the fix, it works fine now on devel! Are your requests in #30623 (comment) still required? I did not have time to do that before, but I can do it now. |
* Fix fact failures cause by ordering of collectors Some fact collectors need info collected by other facts. (for ex, service_mgr needs to know 'ansible_system'). This info is passed to the Collector.collect method via the 'collected_facts' info. But, the order the fact collectors were running in is not a set order, so collectors like service_mgr could run before the PlatformFactCollect ('ansible_system', etc), so the 'ansible_system' fact would not exist yet. Depending on the collector and the deps, this can result in incorrect behavior and wrong or missing facts. To make the ordering of the collectors more consistent and predictable, the code that builds that list is now driven by the order of collectors in default_collectors.py, and the rest of the code tries to preserve it. * Flip the loops when building collector names iterate over the ordered default_collectors list selecting them for the final list in order instead of driving it from the unordered collector_names set. This lets the list returned by select_collector_classes to stay in the same order as default_collectors.collectors For collectors that have implicit deps on other fact collectors, the default collectors can be ordered to include those early. * default_collectors.py now uses a handful of sub lists of collectors that can be ordered in default_collectors.collectors. fixes #30753 fixes #30623
* Fix fact failures cause by ordering of collectors Some fact collectors need info collected by other facts. (for ex, service_mgr needs to know 'ansible_system'). This info is passed to the Collector.collect method via the 'collected_facts' info. But, the order the fact collectors were running in is not a set order, so collectors like service_mgr could run before the PlatformFactCollect ('ansible_system', etc), so the 'ansible_system' fact would not exist yet. Depending on the collector and the deps, this can result in incorrect behavior and wrong or missing facts. To make the ordering of the collectors more consistent and predictable, the code that builds that list is now driven by the order of collectors in default_collectors.py, and the rest of the code tries to preserve it. * Flip the loops when building collector names iterate over the ordered default_collectors list selecting them for the final list in order instead of driving it from the unordered collector_names set. This lets the list returned by select_collector_classes to stay in the same order as default_collectors.collectors For collectors that have implicit deps on other fact collectors, the default collectors can be ordered to include those early. * default_collectors.py now uses a handful of sub lists of collectors that can be ordered in default_collectors.collectors. fixes #30753 fixes #30623 (cherry picked from commit 95abc1d)
* Fix pkg_mgr fact on OpenBSD Add a OpenBSDPkgMgrFactCollector that hardcodes pkg_mgr to 'openbsd_pkg'. The ansible collector will choose the OpenBSD collector if the system is OpenBSD and the 'Generic' one otherwise. This removes PkgMgrFactCollectors depenency on the 'system' fact being in collected_facts, which also avoids ordering issues (if the pkg mgr fact is collected before the system fact...) Fixes ansible#30623
* Fix fact failures cause by ordering of collectors Some fact collectors need info collected by other facts. (for ex, service_mgr needs to know 'ansible_system'). This info is passed to the Collector.collect method via the 'collected_facts' info. But, the order the fact collectors were running in is not a set order, so collectors like service_mgr could run before the PlatformFactCollect ('ansible_system', etc), so the 'ansible_system' fact would not exist yet. Depending on the collector and the deps, this can result in incorrect behavior and wrong or missing facts. To make the ordering of the collectors more consistent and predictable, the code that builds that list is now driven by the order of collectors in default_collectors.py, and the rest of the code tries to preserve it. * Flip the loops when building collector names iterate over the ordered default_collectors list selecting them for the final list in order instead of driving it from the unordered collector_names set. This lets the list returned by select_collector_classes to stay in the same order as default_collectors.collectors For collectors that have implicit deps on other fact collectors, the default collectors can be ordered to include those early. * default_collectors.py now uses a handful of sub lists of collectors that can be ordered in default_collectors.collectors. fixes ansible#30753 fixes ansible#30623
* Fix pkg_mgr fact on OpenBSD Add a OpenBSDPkgMgrFactCollector that hardcodes pkg_mgr to 'openbsd_pkg'. The ansible collector will choose the OpenBSD collector if the system is OpenBSD and the 'Generic' one otherwise. This removes PkgMgrFactCollectors depenency on the 'system' fact being in collected_facts, which also avoids ordering issues (if the pkg mgr fact is collected before the system fact...) Fixes ansible#30623
* Fix fact failures cause by ordering of collectors Some fact collectors need info collected by other facts. (for ex, service_mgr needs to know 'ansible_system'). This info is passed to the Collector.collect method via the 'collected_facts' info. But, the order the fact collectors were running in is not a set order, so collectors like service_mgr could run before the PlatformFactCollect ('ansible_system', etc), so the 'ansible_system' fact would not exist yet. Depending on the collector and the deps, this can result in incorrect behavior and wrong or missing facts. To make the ordering of the collectors more consistent and predictable, the code that builds that list is now driven by the order of collectors in default_collectors.py, and the rest of the code tries to preserve it. * Flip the loops when building collector names iterate over the ordered default_collectors list selecting them for the final list in order instead of driving it from the unordered collector_names set. This lets the list returned by select_collector_classes to stay in the same order as default_collectors.collectors For collectors that have implicit deps on other fact collectors, the default collectors can be ordered to include those early. * default_collectors.py now uses a handful of sub lists of collectors that can be ordered in default_collectors.collectors. fixes ansible#30753 fixes ansible#30623
Hi,
ISSUE TYPE
COMPONENT NAME
Facts
ANSIBLE VERSION
CONFIGURATION
OS / ENVIRONMENT
Ansible running from ArchLinux, managing an OpenBSD machine.
SUMMARY
Since Ansible 2.4, the
ansible_pkg_mgr
fact is set tounknown
, instead ofopenbsd_pkg
(<= Ansible 2.3.2.0). As thepackage
module uses this variable to choose the package manager to invoke, it became unusable on OpenBSD.STEPS TO REPRODUCE
Execute the following command with an OpenBSD machine as a target:
EXPECTED RESULTS
ACTUAL RESULTS
Let me know if I can be of any help concerning this issue.
Regards
The text was updated successfully, but these errors were encountered: