From f974f7a0cd8a256c6fcb8c05d16cf06b69b48382 Mon Sep 17 00:00:00 2001 From: Jimmy McCrory Date: Tue, 6 Sep 2016 11:24:00 -0700 Subject: [PATCH] Deserialize glance image_properties Glance requires that the passed image properties be an iterable dictionary. Update the documented example to use YAML's syntax for a dictionary instead of a JSON string. The resulting string will be deserialized to a Python dict. Change-Id: I2f02a4e772398d0c133d3109058d55c4f96b72f7 --- library/glance | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/library/glance b/library/glance index ad10976..73cc513 100644 --- a/library/glance +++ b/library/glance @@ -13,9 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. - import glanceclient.client as glclient import keystoneclient.v3.client as ksclient +import yaml # import module snippets from ansible.module_utils.basic import * @@ -88,7 +88,8 @@ EXAMPLES = """ image_container_format: bare image_disk_format: qcow2 image_is_public: True - image_properties: { "os_distro": "cirros" } + image_properties: + os_distro: cirros # Get facts about existing images - name: Get image facts @@ -190,7 +191,7 @@ class ManageGlance(object): copy_from=p['image_url'] ) if p['image_properties']: - image_opts['properties'] = p['image_properties'] + image_opts['properties'] = yaml.load(p['image_properties']) if v == '1': image_opts['is_public'] = p['image_is_public'] elif v == '2':