Closed itdependsnetworks closed 3 months ago
here is the error without extends_documentation_fragment
set.
toml declined parsing /github/cookbook/inventory.yml as it did not pass its verify_file() method
[WARNING]: * Failed to parse /github/cookbook/inventory.yml with script plugin: problem running /github/cookbook/inventory.yml --list ([Errno 8] Exec format error: '/github/cookbook/inventory.yml')
File "/usr/local/lib/python3.11/site-packages/ansible/inventory/manager.py", line 293, in parse_source
plugin.parse(self._inventory, self._loader, source, cache=cache)
File "/usr/local/lib/python3.11/site-packages/ansible/plugins/inventory/script.py", line 150, in parse
raise AnsibleParserError(to_native(e))
[WARNING]: * Failed to parse /github/cookbook/inventory.yml with auto plugin: 'Requested entry (plugin_type: inventory plugin: ansible_collections.networktocode.nautobot.plugins.inventory.gql_inventory setting: strict ) was not defined in
configuration.'
File "/usr/local/lib/python3.11/site-packages/ansible/inventory/manager.py", line 293, in parse_source
plugin.parse(self._inventory, self._loader, source, cache=cache)
File "/usr/local/lib/python3.11/site-packages/ansible/plugins/inventory/auto.py", line 59, in parse
plugin.parse(inventory, loader, path, cache=cache)
File "/root/.ansible/collections/ansible_collections/networktocode/nautobot/plugins/inventory/gql_inventory.py", line 431, in parse
self.main()
File "/root/.ansible/collections/ansible_collections/networktocode/nautobot/plugins/inventory/gql_inventory.py", line 396, in main
strict = self.get_option("strict")
^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/ansible/plugins/__init__.py", line 77, in get_option
raise KeyError(to_native(e))
The crux of it is that at some point (set_options -> get_plugin_options -> get_configuration_definitions
) this gets called which basically the ansible doc values and sets the options. Already down a far enough rabbit hole, but if want to look into it in the future, at least documented where I left off.
Yup, you need to extend the doc fragment according to the docs: https://docs.ansible.com/ansible/latest/dev_guide/developing_inventory.html#constructed-features
It is worth nothing that in my testing
extends_documentation_fragment
is impacting to the inventory successfully working, meaning if the below is removed it will fail with an error on theget_options
calls to strict or compose.