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
This commit is contained in:
parent
ffb02cfb55
commit
f974f7a0cd
@ -13,9 +13,9 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
|
||||||
import glanceclient.client as glclient
|
import glanceclient.client as glclient
|
||||||
import keystoneclient.v3.client as ksclient
|
import keystoneclient.v3.client as ksclient
|
||||||
|
import yaml
|
||||||
|
|
||||||
# import module snippets
|
# import module snippets
|
||||||
from ansible.module_utils.basic import *
|
from ansible.module_utils.basic import *
|
||||||
@ -88,7 +88,8 @@ EXAMPLES = """
|
|||||||
image_container_format: bare
|
image_container_format: bare
|
||||||
image_disk_format: qcow2
|
image_disk_format: qcow2
|
||||||
image_is_public: True
|
image_is_public: True
|
||||||
image_properties: { "os_distro": "cirros" }
|
image_properties:
|
||||||
|
os_distro: cirros
|
||||||
|
|
||||||
# Get facts about existing images
|
# Get facts about existing images
|
||||||
- name: Get image facts
|
- name: Get image facts
|
||||||
@ -190,7 +191,7 @@ class ManageGlance(object):
|
|||||||
copy_from=p['image_url']
|
copy_from=p['image_url']
|
||||||
)
|
)
|
||||||
if p['image_properties']:
|
if p['image_properties']:
|
||||||
image_opts['properties'] = p['image_properties']
|
image_opts['properties'] = yaml.load(p['image_properties'])
|
||||||
if v == '1':
|
if v == '1':
|
||||||
image_opts['is_public'] = p['image_is_public']
|
image_opts['is_public'] = p['image_is_public']
|
||||||
elif v == '2':
|
elif v == '2':
|
||||||
|
Loading…
Reference in New Issue
Block a user