Merge pull request #13082 from resmo/for-ansible

cloudstack: fixes in tags handling
pull/13071/merge
James Cammarata 9 years ago
commit cb8683df7f

@ -348,9 +348,10 @@ class AnsibleCloudStack(object):
args['resourcetype'] = resource_type args['resourcetype'] = resource_type
args['tags'] = tags args['tags'] = tags
if operation == "create": if operation == "create":
self.cs.createTags(**args) response = self.cs.createTags(**args)
else: 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): def _tags_that_should_exist_or_be_updated(self, resource, tags):
@ -370,8 +371,8 @@ class AnsibleCloudStack(object):
if 'tags' in resource: if 'tags' in resource:
tags = self.module.params.get('tags') tags = self.module.params.get('tags')
if tags is not None: 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_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 self.tags = None
resource['tags'] = self.get_tags(resource) resource['tags'] = self.get_tags(resource)
return resource return resource

Loading…
Cancel
Save