cs_serviceoffer: remove unused code and improve test coverage (#33276)

pull/33288/head
René Moser 7 years ago committed by GitHub
parent e197a94f2b
commit 1f9e84fdd4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -374,10 +374,8 @@ class AnsibleCloudStackServiceOffering(AnsibleCloudStack):
'systemvmtype': 'system_vm_type',
'tags': 'storage_tags',
}
self.service_offering = None
def get_service_offering(self):
if not self.service_offering:
args = {
'name': self.module.params.get('name'),
'domainid': self.get_domain(key='id'),
@ -395,12 +393,6 @@ class AnsibleCloudStackServiceOffering(AnsibleCloudStack):
else:
service_offering = self._update_offering(service_offering)
if service_offering:
service_offering = self.ensure_tags(
resource=service_offering,
resource_type='ServiceOffering'
)
return service_offering
def absent_service_offering(self):
@ -422,7 +414,7 @@ class AnsibleCloudStackServiceOffering(AnsibleCloudStack):
required_params = []
if is_system and not system_vm_type:
required_params.add('system_vm_type')
required_params.append('system_vm_type')
self.module.fail_on_missing_params(required_params=required_params)
args = {

@ -10,6 +10,26 @@
that:
- so|success
- name: fail missing storage type and is_system
cs_serviceoffer:
name: System Offering for Ansible
cpu_number: 1
cpu_speed: 500
memory: 512
host_tag: perf
storage_tag: perf
storage_type: shared
offer_ha: true
limit_cpu_usage: false
is_system: true
register: so
ignore_errors: true
- name: verify create system service offering in check mode
assert:
that:
- so|failed
- so.msg.startswith('missing required arguments:')
- name: create system service offering in check mode
cs_serviceoffer:
name: System Offering for Ansible

Loading…
Cancel
Save