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
projects:
- graphite-playground
filters:
auth_kind: serviceaccount
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):
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']
zones = config_data.get('zones')
config_data['scopes'] = ['https://www.googleapis.com/auth/compute']