1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Put in documented default for gcp_compute filters (#50025)

This commit is contained in:
Alan Rominger 2019-01-18 06:39:24 -05:00 committed by John R Barker
parent 0ce9593986
commit baf59ccaac
3 changed files with 6 additions and 1 deletions

View file

@ -0,0 +1,2 @@
bugfixes:
- gcp_compute inventory plugin - apply documented default when one is not provided.

View file

@ -145,7 +145,6 @@ Here's an example of a valid inventory file:
plugin: gcp_compute plugin: gcp_compute
projects: projects:
- graphite-playground - graphite-playground
filters:
auth_kind: serviceaccount auth_kind: serviceaccount
service_account_file: /home/alexstephen/my_account.json service_account_file: /home/alexstephen/my_account.json

View file

@ -337,6 +337,10 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable):
if not isinstance(config_data['projects'], list): if not isinstance(config_data['projects'], list):
raise AnsibleParserError("Projects must be a list in GCP inventory YAML files") raise AnsibleParserError("Projects must be a list in GCP inventory YAML files")
# add in documented defaults
if 'filters' not in config_data:
config_data['filters'] = None
projects = config_data['projects'] projects = config_data['projects']
zones = config_data.get('zones') zones = config_data.get('zones')
config_data['scopes'] = ['https://www.googleapis.com/auth/compute'] config_data['scopes'] = ['https://www.googleapis.com/auth/compute']