From 7fec0b69a082aaeec72fee0612766aa42f6b1b4d Mon Sep 17 00:00:00 2001 From: Daniel Baumann <daniel.baumann@progress-linux.org> Date: Thu, 18 Apr 2024 07:52:35 +0200 Subject: Merging upstream version 9.4.0+dfsg. Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org> --- .../google/cloud/plugins/inventory/gcp_compute.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'ansible_collections/google/cloud/plugins/inventory') diff --git a/ansible_collections/google/cloud/plugins/inventory/gcp_compute.py b/ansible_collections/google/cloud/plugins/inventory/gcp_compute.py index d380acd96..f4743b292 100644 --- a/ansible_collections/google/cloud/plugins/inventory/gcp_compute.py +++ b/ansible_collections/google/cloud/plugins/inventory/gcp_compute.py @@ -39,7 +39,7 @@ DOCUMENTATION = """ description: > A list of filter value pairs. Available filters are listed here U(https://cloud.google.com/compute/docs/reference/rest/v1/instances/aggregatedList). - Each additional filter in the list will act be added as an AND condition + Each additional filter in the list will be added as an AND condition (filter1 and filter2) type: list hostnames: @@ -57,7 +57,7 @@ DOCUMENTATION = """ description: - The type of credential used. required: True - choices: ['application', 'serviceaccount', 'machineaccount'] + choices: ['application', 'serviceaccount', 'machineaccount', 'accesstoken'] env: - name: GCP_AUTH_KIND scopes: @@ -86,6 +86,11 @@ DOCUMENTATION = """ and the user does not wish to use the default email. env: - name: GCP_SERVICE_ACCOUNT_EMAIL + access_token: + description: + - An OAuth2 access token if credential type is accesstoken. + env: + - name: GCP_ACCESS_TOKEN vars_prefix: description: prefix to apply to host variables, does not include facts nor params default: '' @@ -232,7 +237,8 @@ class GcpInstance(object): for order in self.hostname_ordering: name = None if order.startswith("labels."): - name = self.json["labels"].get(order[7:]) + if "labels" in self.json: + name = self.json["labels"].get(order[7:]) elif order == "public_ip": name = self._get_publicip() elif order == "private_ip": @@ -558,6 +564,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable): "service_account_file": self.get_option("service_account_file"), "service_account_contents": self.get_option("service_account_contents"), "service_account_email": self.get_option("service_account_email"), + "access_token": self.get_option("access_token"), } self.fake_module = GcpMockModule(params) -- cgit v1.2.3