diff options
author | Brian Coca <bcoca@users.noreply.github.com> | 2019-03-08 13:03:46 -0500 |
---|---|---|
committer | Toshio Kuratomi <a.badger@gmail.com> | 2019-03-11 12:53:52 -0700 |
commit | c93bfe9931c90c6825907ba5e15d4906fc60c1d3 (patch) | |
tree | c2a2c0178a84775890ca0187b6f32680cb8ea0db | |
parent | 3944f516777de479bd8f127f4a3fe82f8f6219cb (diff) | |
download | ansible-c93bfe9931c90c6825907ba5e15d4906fc60c1d3.tar.gz |
allow nontype configdata (#53365)
(cherry picked from commit 90bcff3d92a7ec289d25896ff120e15bf7dace38)
-rw-r--r-- | changelogs/fragments/auto_nice_error.yml | 2 | ||||
-rw-r--r-- | lib/ansible/plugins/inventory/auto.py | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/changelogs/fragments/auto_nice_error.yml b/changelogs/fragments/auto_nice_error.yml new file mode 100644 index 0000000000..4e97c53d92 --- /dev/null +++ b/changelogs/fragments/auto_nice_error.yml @@ -0,0 +1,2 @@ +bugfixes: + - allow nice error to work when auto plugin reads file w/o `plugin` field diff --git a/lib/ansible/plugins/inventory/auto.py b/lib/ansible/plugins/inventory/auto.py index f444acee90..d0ccccf96a 100644 --- a/lib/ansible/plugins/inventory/auto.py +++ b/lib/ansible/plugins/inventory/auto.py @@ -39,7 +39,10 @@ class InventoryModule(BaseInventoryPlugin): def parse(self, inventory, loader, path, cache=True): config_data = loader.load_from_file(path, cache=False) - plugin_name = config_data.get('plugin') + try: + plugin_name = config_data.get('plugin', None) + except AttributeError: + plugin_name = None if not plugin_name: raise AnsibleParserError("no root 'plugin' key found, '{0}' is not a valid YAML inventory plugin config file".format(path)) |