2
0
mirror of https://opendev.org/x/pyghmi synced 2025-01-27 19:37:44 +00:00

Fix BMC security config

It was only enabled for SD530, extend
the support for non-D2 platform servers.

Change-Id: I3dfa02b1eef4baedc12e0e031278c7bc49627e4e
This commit is contained in:
Jarrod Johnson 2019-11-06 14:15:53 -05:00
parent 2e9a81f8f1
commit 0ba4437422

View File

@ -821,23 +821,7 @@ class XCCClient(IMMClient):
return {'height': int(dsc['u-height']), 'slot': int(dsc['slot'])}
def get_bmc_configuration(self):
try:
enclosureinfo = self.ipmicmd.xraw_command(0x3a, 0xf1, data=[0])
except pygexc.IpmiException:
return {}
settings = {
'smm': {
'default': 'Disable',
'possible': ['Enable', 'Disable'],
'help': 'Enables or disables the network of the D2 enclosure manager.',
}
}
if enclosureinfo['data'][0] == '\x02':
settings['smm']['value'] = 'Disable'
elif enclosureinfo['data'][0] == '\x01':
settings['smm']['value'] = 'Enable'
else:
settings['smm']['value'] = None
settings = {}
passrules = self.wc.grab_json_response('/api/dataset/imm_users_global')
passrules = passrules.get('items', [{}])[0]
settings['password_reuse_count'] = {'value': passrules.get('pass_min_resuse')}
@ -847,6 +831,21 @@ class XCCClient(IMMClient):
settings['password_complexity'] = {'value': passrules.get('pass_complex_required')}
settings['password_min_length'] = {'value': passrules.get('pass_min_length')}
settings['password_lockout_period'] = {'value': passrules.get('lockout_period')}
try:
enclosureinfo = self.ipmicmd.xraw_command(0x3a, 0xf1, data=[0])
except pygexc.IpmiException:
return settings
settings['smm'] = {
'default': 'Disable',
'possible': ['Enable', 'Disable'],
'help': 'Enables or disables the network of the D2 enclosure manager.',
}
if enclosureinfo['data'][0] == '\x02':
settings['smm']['value'] = 'Disable'
elif enclosureinfo['data'][0] == '\x01':
settings['smm']['value'] = 'Enable'
else:
settings['smm']['value'] = None
return settings
rulemap = {