Merge pull request #13082 from resmo/for-ansible

cloudstack: fixes in tags handling
This commit is contained in:
James Cammarata
2015-11-09 10:55:24 -05:00

View File

@@ -348,9 +348,10 @@ class AnsibleCloudStack(object):
args['resourcetype'] = resource_type
args['tags'] = tags
if operation == "create":
self.cs.createTags(**args)
response = self.cs.createTags(**args)
else:
self.cs.deleteTags(**args)
response = self.cs.deleteTags(**args)
self.poll_job(response)
def _tags_that_should_exist_or_be_updated(self, resource, tags):
@@ -370,8 +371,8 @@ class AnsibleCloudStack(object):
if 'tags' in resource:
tags = self.module.params.get('tags')
if tags is not None:
self._process_tags(resource, resource_type, self._tags_that_should_exist_or_be_updated(resource, tags))
self._process_tags(resource, resource_type, self._tags_that_should_not_exist(resource, tags), operation="delete")
self._process_tags(resource, resource_type, self._tags_that_should_exist_or_be_updated(resource, tags))
self.tags = None
resource['tags'] = self.get_tags(resource)
return resource