From 16ee4368221846af0270a7282fb5d751b428845d Mon Sep 17 00:00:00 2001 From: Alex Stephen Date: Fri, 8 Jun 2018 07:19:25 -0700 Subject: [PATCH] GCP: Fix gcp_instance metadata keys (#41293) --- lib/ansible/modules/cloud/google/gcp_compute_instance.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/ansible/modules/cloud/google/gcp_compute_instance.py b/lib/ansible/modules/cloud/google/gcp_compute_instance.py index 4f49552e393..cb48c1deca1 100644 --- a/lib/ansible/modules/cloud/google/gcp_compute_instance.py +++ b/lib/ansible/modules/cloud/google/gcp_compute_instance.py @@ -1108,7 +1108,10 @@ def metadata_encoder(metadata): metadata_new = [] for key in metadata: value = metadata[key] - metadata_new.append({key: value}) + metadata_new.append({ + "key": key, + "value": value + }) return { 'items': metadata_new } @@ -1120,7 +1123,7 @@ def metadata_decoder(metadata): if 'items' in metadata: metadata_items = metadata['items'] for item in metadata_items: - items[item.keys()[0]] = item[item.keys()[0]] + items[item['key']] = item['value'] return items