summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené Moser <mail@renemoser.net>2018-09-26 09:05:48 +0200
committerGitHub <noreply@github.com>2018-09-26 09:05:48 +0200
commitf73996e6ebc25a453caef3631558fca6e1af4a4e (patch)
tree198e0bdcfec08ca9e3972e6bf6c1380d99db81c6
parent48b999244616204b800161dd3b775b9bf2a26081 (diff)
downloadansible-f73996e6ebc25a453caef3631558fca6e1af4a4e.tar.gz
cs_resourcelimit: use query_api for error handling (#46036)
-rw-r--r--lib/ansible/modules/cloud/cloudstack/cs_resourcelimit.py30
1 files changed, 8 insertions, 22 deletions
diff --git a/lib/ansible/modules/cloud/cloudstack/cs_resourcelimit.py b/lib/ansible/modules/cloud/cloudstack/cs_resourcelimit.py
index 443f94bbc7..ac1d130210 100644
--- a/lib/ansible/modules/cloud/cloudstack/cs_resourcelimit.py
+++ b/lib/ansible/modules/cloud/cloudstack/cs_resourcelimit.py
@@ -1,22 +1,8 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
-# (c) 2016, René Moser <mail@renemoser.net>
-#
-# This file is part of Ansible
-#
-# Ansible is free software: you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation, either version 3 of the License, or
-# (at your option) any later version.
-#
-# Ansible is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
+# Copyright (c) 2016, René Moser <mail@renemoser.net>
+# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['stableinterface'],
@@ -68,15 +54,15 @@ extends_documentation_fragment: cloudstack
'''
EXAMPLES = '''
-# Update a resource limit for instances of a domain
-- local_action:
+- name: Update a resource limit for instances of a domain
+ local_action:
module: cs_resourcelimit
type: instance
limit: 10
domain: customers
-# Update a resource limit for instances of an account
-- local_action:
+- name: Update a resource limit for instances of an account
+ local_action:
module: cs_resourcelimit
type: instance
limit: 12
@@ -156,7 +142,7 @@ class AnsibleCloudStackResourceLimit(AnsibleCloudStack):
'projectid': self.get_project(key='id'),
'resourcetype': self.get_resource_type()
}
- resource_limit = self.cs.listResourceLimits(**args)
+ resource_limit = self.query_api('listResourceLimits', **args)
if resource_limit:
if 'limit' in resource_limit['resourcelimit'][0]:
resource_limit['resourcelimit'][0]['limit'] = int(resource_limit['resourcelimit'][0])
@@ -177,7 +163,7 @@ class AnsibleCloudStackResourceLimit(AnsibleCloudStack):
if self.has_changed(args, resource_limit):
self.result['changed'] = True
if not self.module.check_mode:
- res = self.cs.updateResourceLimit(**args)
+ res = self.query_api('updateResourceLimit', **args)
resource_limit = res['resourcelimit']
return resource_limit