Filter out DPU from systems collection if ambiguous
DPUs may manifest in a Systems collection. If the caller does not specify sysurl, they are almost certainly wanting to manage the 'main' system, not an adapter. Provide for this expectation by retrying the collection with DPU filtered out, so that if there's exactly one non-DPU system, then it will still be functional. Change-Id: I300c47245111121440ae0f037d202b074407c45d
This commit is contained in:
parent
8ac115a8a7
commit
3c5b03c35f
|
@ -194,13 +194,15 @@ class Command(object):
|
||||||
systems = members['Members']
|
systems = members['Members']
|
||||||
if sysurl:
|
if sysurl:
|
||||||
for system in systems:
|
for system in systems:
|
||||||
if system['@odata.id'] == sysurl:
|
if system['@odata.id'] == sysurl or system['@odata.id'].split('/')[-1] == sysurl:
|
||||||
self.sysurl = sysurl
|
self.sysurl = system['@odata.id']
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
raise exc.PyghmiException(
|
raise exc.PyghmiException(
|
||||||
'Specified sysurl not found: {0}'.format(sysurl))
|
'Specified sysurl not found: {0}'.format(sysurl))
|
||||||
else:
|
else:
|
||||||
|
if len(systems) != 1:
|
||||||
|
systems = [x for x in systems if 'DPU' not in x['@odata.id']]
|
||||||
if len(systems) != 1:
|
if len(systems) != 1:
|
||||||
raise exc.PyghmiException(
|
raise exc.PyghmiException(
|
||||||
'Multi system manager, sysurl is required parameter')
|
'Multi system manager, sysurl is required parameter')
|
||||||
|
|
Loading…
Reference in New Issue