Skip to content

Commit

Permalink
Do not try to encode metadata if it is None (#46739)
Browse files Browse the repository at this point in the history
* Do not try to encode metadata if it is None

* Add changelog fragment

* Fix fragment missing EOF line
  • Loading branch information
thpica authored and mkrizek committed Oct 10, 2018
1 parent fcef4fd commit 62d1317
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 2 additions & 0 deletions changelogs/fragments/46739-gcp-compute-instance-metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:
- "gcp_compute_instance - fix crash when the instance metadata is not set"
2 changes: 1 addition & 1 deletion lib/ansible/modules/cloud/google/gcp_compute_instance.py
Original file line number Diff line number Diff line change
Expand Up @@ -1106,7 +1106,7 @@ def raise_if_errors(response, err_path, module):


def encode_request(request, module):
if 'metadata' in request:
if 'metadata' in request and request['metadata'] is not None:
request['metadata'] = metadata_encoder(request['metadata'])
return request

Expand Down

0 comments on commit 62d1317

Please sign in to comment.