10.0.0
This commit is contained in:
@@ -28,7 +28,7 @@ class decort_bservice(DecortController):
|
||||
self.fail_json(**self.result)
|
||||
if not arg_amodule.params['id']:
|
||||
if not arg_amodule.params['rg_id']: # RG ID is not set -> locate RG by name -> need account ID
|
||||
validated_acc_id, self.acc_info = self.account_find(arg_amodule.params['account_name'],
|
||||
validated_acc_id, self._acc_info = self.account_find(arg_amodule.params['account_name'],
|
||||
arg_amodule.params['account_id'])
|
||||
if not validated_acc_id:
|
||||
self.result['failed'] = True
|
||||
@@ -113,7 +113,7 @@ class decort_bservice(DecortController):
|
||||
)
|
||||
if self.bservice_id:
|
||||
_, self.bservice_info = self.bservice_get_by_id(self.bservice_id)
|
||||
self.bservice_state(self.bservice_info,'enabled')
|
||||
self.bservice_state(self.bservice_info, self.aparams['state'])
|
||||
return
|
||||
|
||||
def action(self,d_state):
|
||||
@@ -176,7 +176,6 @@ class decort_bservice(DecortController):
|
||||
),
|
||||
state=dict(
|
||||
type='str',
|
||||
default='present',
|
||||
choices=[
|
||||
'absent',
|
||||
'disabled',
|
||||
@@ -298,25 +297,30 @@ def main():
|
||||
subj.action(amodule.params['state'])
|
||||
if amodule.params['state'] == 'absent':
|
||||
subj.nop()
|
||||
elif subj.bservice_info['status'] in ('ENABLED', 'DISABLED'):
|
||||
elif subj.bservice_info['status'] in (
|
||||
'ENABLED', 'DISABLED', 'CREATED',
|
||||
):
|
||||
if amodule.params['state'] == 'absent':
|
||||
subj.destroy()
|
||||
else:
|
||||
subj.action(amodule.params['state'])
|
||||
elif subj.bservice_info['status'] == "DESTROED":
|
||||
elif subj.bservice_info['status'] == "DESTROYED":
|
||||
if amodule.params['state'] in ('present','enabled'):
|
||||
subj.create()
|
||||
subj.action(amodule.params['state'])
|
||||
if amodule.params['state'] == 'absent':
|
||||
subj.nop()
|
||||
else:
|
||||
if amodule.params['state'] == 'absent':
|
||||
state = amodule.params['state']
|
||||
if state is None:
|
||||
state = 'present'
|
||||
if state == 'absent':
|
||||
subj.nop()
|
||||
if amodule.params['state'] in ('present','started'):
|
||||
if state in ('present','started'):
|
||||
subj.create()
|
||||
elif amodule.params['state'] in ('stopped', 'disabled','enabled'):
|
||||
elif state in ('stopped', 'disabled','enabled'):
|
||||
subj.error()
|
||||
|
||||
|
||||
if subj.result['failed']:
|
||||
amodule.fail_json(**subj.result)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user