Skip to content
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

Spurious warning when using a custom fact module #79631

Open
1 task done
andreby opened this issue Dec 27, 2022 · 4 comments
Open
1 task done

Spurious warning when using a custom fact module #79631

andreby opened this issue Dec 27, 2022 · 4 comments
Labels
affects_2.14 bug This issue/PR relates to a bug. module This issue/PR relates to a module. P3 Priority 3 - Approved, No Time Limitation

Comments

@andreby
Copy link

andreby commented Dec 27, 2022

Summary

When using a custom fact module, a warning is printed about "ignoring subset(None)".

This warning has been reported before and a commented upon but it appears that the fix was left out.

Issue Type

Bug Report

Component Name

gather_facts.py

Ansible Version

$ ansible --version
ansible [core 2.14.1]
  config file = None
  configured module search path = ['/home/user/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/user/.local/pipx/venvs/ansible/lib/python3.10/site-packages/ansible
  ansible collection location = /home/user/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/user/.local/bin/ansible
  python version = 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0] (/home/user/.local/pipx/venvs/ansible/bin/python)
  jinja version = 3.1.2
  libyaml = True

Configuration

CONFIG_FILE() = None

OS / Environment

Linux

Steps to Reproduce

The custom fact module looks like this:

#!/bin/sh

echo '{"ansible_facts": {"myfact": "hello!"}}'

When the custom fact module is picked up by ansible, a warning is printed about "Ignoring subset(None)":

ANSIBLE_LIBRARY=./library ANSIBLE_FACTS_MODULES=myfacts,smart ansible -m gather_facts  localhost | grep myfact
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: Ignoring subset(None) for myfacts
            "ANSIBLE_FACTS_MODULES": "myfacts,smart",
        "myfact": "hello!"

Expected Results

Custom fact module to be used without warnings.

Actual Results

Spurious warning is printed.

Code of Conduct

  • I agree to follow the Ansible Code of Conduct
@ansibot
Copy link
Contributor

ansibot commented Dec 27, 2022

Files identified in the description:

If these files are incorrect, please update the component name section of the description or use the !component bot command.

click here for bot help

@ansibot ansibot added affects_2.14 bug This issue/PR relates to a bug. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. labels Dec 27, 2022
@konstruktoid
Copy link
Contributor

Return only the fact itself, echo '{"myfact": "hello!"}' and then call it with ansible_local.<fact name>.myfact

@andreby
Copy link
Author

andreby commented Dec 27, 2022

@konstruktoid Thanks! - but I believe you're thinking of custom facts, where a file is created in /etc/ansible/facts.d on the target?

This bug report is instead about the (lesser known) custom fact module which lives on the controller and is used during the (usually implicit) fact gathering phase by the gather_facts module.

@konstruktoid
Copy link
Contributor

You are absolutely correct @andreby, ignore my comment :)

@bcoca bcoca added P3 Priority 3 - Approved, No Time Limitation and removed needs_triage Needs a first human triage before being processed. labels Jan 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects_2.14 bug This issue/PR relates to a bug. module This issue/PR relates to a module. P3 Priority 3 - Approved, No Time Limitation
Projects
None yet
Development

No branches or pull requests

4 participants