2
0
mirror of https://opendev.org/x/pyghmi synced 2025-01-31 05:17:39 +00:00

Fix DHCP config logic on static input

Have static address and gateway both clarify
so that the DHCP logic does not get confused.

Change-Id: If1fa41e27c34694fc47d6a805c72ef6922ab38f4
This commit is contained in:
Jarrod Johnson 2021-03-23 07:57:23 -04:00
parent f42d75ea9d
commit ce333b3bfc

View File

@ -1168,11 +1168,13 @@ class Command(object):
netmask = _cidr_to_mask(int(cidr))
patch['IPv4StaticAddresses'] = [ipinfo]
ipinfo['Address'] = ipv4_address
ipv4_configuration = 'static'
if netmask:
ipinfo['SubnetMask'] = netmask
if ipv4_gateway:
patch['IPv4StaticAddresses'] = [ipinfo]
ipinfo['Gateway'] = ipv4_gateway
ipv4_configuration = 'static'
if ipv4_configuration.lower() == 'dhcp':
dodhcp = True
patch['DHCPv4'] = {'DHCPEnabled': True}