Merge branch 'dev_bsgroup_rc-5.2.6' into 'rc-5.2.6'
decort_group module bug fixes See merge request rudecs/dev/decort-ansible!80
This commit is contained in:
@@ -132,6 +132,7 @@ class decort_group(DecortController):
|
|||||||
self.bservice_id,
|
self.bservice_id,
|
||||||
self.group_id
|
self.group_id
|
||||||
)
|
)
|
||||||
|
self.group_should_exist = False
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
@@ -206,10 +207,23 @@ class decort_group(DecortController):
|
|||||||
bservice_id=dict(type='int', required=True),
|
bservice_id=dict(type='int', required=True),
|
||||||
count=dict(type='int', required=True),
|
count=dict(type='int', required=True),
|
||||||
timeoutStart=dict(type='int', required=False),
|
timeoutStart=dict(type='int', required=False),
|
||||||
role=dict(type='str', required=False),
|
role=dict(type='str', required=False, default=''),
|
||||||
cpu=dict(type='int', required=False),
|
cpu=dict(type='int', required=False),
|
||||||
ram=dict(type='int', required=False),
|
ram=dict(type='int', required=False),
|
||||||
networks=dict(type='list', default=[], required=False),
|
networks=dict(
|
||||||
|
type='list', default=[], elements='dict',
|
||||||
|
options=dict(
|
||||||
|
type=dict(
|
||||||
|
type='str',
|
||||||
|
required=True,
|
||||||
|
choices=['VINS', 'EXTNET']
|
||||||
|
),
|
||||||
|
id=dict(
|
||||||
|
type='int',
|
||||||
|
required=True
|
||||||
|
)
|
||||||
|
)
|
||||||
|
),
|
||||||
description=dict(type='str', default="Created by decort ansible module"),
|
description=dict(type='str', default="Created by decort ansible module"),
|
||||||
verify_ssl=dict(type='bool', required=False, default=True),
|
verify_ssl=dict(type='bool', required=False, default=True),
|
||||||
workflow_callback=dict(type='str', required=False),
|
workflow_callback=dict(type='str', required=False),
|
||||||
|
|||||||
@@ -3868,11 +3868,12 @@ class DecortController(object):
|
|||||||
self.result['waypoints'] = "{} -> {}".format(self.result['waypoints'], "group_find")
|
self.result['waypoints'] = "{} -> {}".format(self.result['waypoints'], "group_find")
|
||||||
|
|
||||||
if group_id == 0:
|
if group_id == 0:
|
||||||
try:
|
for group in bs_info['groups']:
|
||||||
i = bs_info['groupsName'].index(group_name)
|
if group['name'] == group_name:
|
||||||
except:
|
return self._group_get_by_id(bs_id=bs_id,
|
||||||
return 0,None
|
g_id=group['id'])
|
||||||
group_id = int(bs_info['groups'][i])
|
return 0, None
|
||||||
|
|
||||||
return self._group_get_by_id(bs_id,group_id)
|
return self._group_get_by_id(bs_id,group_id)
|
||||||
|
|
||||||
def group_state(self,bs_id,gr_id,desired_state):
|
def group_state(self,bs_id,gr_id,desired_state):
|
||||||
@@ -3966,7 +3967,7 @@ class DecortController(object):
|
|||||||
else:
|
else:
|
||||||
list_extnet.append(net['id'])
|
list_extnet.append(net['id'])
|
||||||
|
|
||||||
if gr_dict['vinses'] != list_vins:
|
if sorted(gr_dict['vinses']) != sorted(list_vins):
|
||||||
api_url = "/restmachine/cloudapi/bservice/groupUpdateVins"
|
api_url = "/restmachine/cloudapi/bservice/groupUpdateVins"
|
||||||
api_params = dict(
|
api_params = dict(
|
||||||
serviceId=bs_id,
|
serviceId=bs_id,
|
||||||
@@ -3988,10 +3989,6 @@ class DecortController(object):
|
|||||||
|
|
||||||
self.result['waypoints'] = "{} -> {}".format(self.result['waypoints'], "group_provision")
|
self.result['waypoints'] = "{} -> {}".format(self.result['waypoints'], "group_provision")
|
||||||
|
|
||||||
list_vins= list()
|
|
||||||
for net in arg_network:
|
|
||||||
if net['type'] == 'VINS':
|
|
||||||
list_vins.append(net['id'])
|
|
||||||
api_url = "/restmachine/cloudapi/bservice/groupAdd"
|
api_url = "/restmachine/cloudapi/bservice/groupAdd"
|
||||||
api_params = dict(
|
api_params = dict(
|
||||||
serviceId = bs_id,
|
serviceId = bs_id,
|
||||||
@@ -4003,13 +4000,15 @@ class DecortController(object):
|
|||||||
imageId = arg_image_id,
|
imageId = arg_image_id,
|
||||||
driver = arg_driver,
|
driver = arg_driver,
|
||||||
role = arg_role,
|
role = arg_role,
|
||||||
vinses = list_vins,
|
vinses = [n['id'] for n in arg_network if n['type'] == 'VINS'],
|
||||||
|
extnets = [n['id'] for n in arg_network if n['type'] == 'EXTNET'],
|
||||||
timeoutStart = arg_timeout
|
timeoutStart = arg_timeout
|
||||||
)
|
)
|
||||||
self.decort_api_call(requests.post, api_url, api_params)
|
api_resp = self.decort_api_call(requests.post, api_url, api_params)
|
||||||
|
new_bsgroup_id = int(api_resp.text)
|
||||||
self.result['failed'] = False
|
self.result['failed'] = False
|
||||||
self.result['changed'] = True
|
self.result['changed'] = True
|
||||||
return
|
return new_bsgroup_id
|
||||||
|
|
||||||
def group_delete(self,bs_id,gr_id):
|
def group_delete(self,bs_id,gr_id):
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user