Fixing bugs
This commit is contained in:
parent
c25610777f
commit
0f57bb1513
1 changed files with 23 additions and 16 deletions
|
@ -262,7 +262,7 @@ def parse_structured_data(body, interface_name, version, module):
|
|||
address = {}
|
||||
address['addr'] = interface_table.get('prefix', None)
|
||||
if address['addr'] is not None:
|
||||
address['mask'] = interface_table.get('masklen', None)
|
||||
address['mask'] = str(interface_table.get('masklen', None))
|
||||
interface['addresses'] = [address]
|
||||
prefix = "{0}/{1}".format(address['addr'], address['mask'])
|
||||
address_list.append(prefix)
|
||||
|
@ -416,6 +416,7 @@ def validate_params(addr, interface, mask, version, state, intf_type, module):
|
|||
if is_default(interface, module) == "DNE":
|
||||
module.fail_json(msg="That interface does not exist yet. Create "
|
||||
"it first.", interface=interface)
|
||||
if mask is not None:
|
||||
try:
|
||||
if (int(mask) < 1 or int(mask) > 32) and version == "v4":
|
||||
raise ValueError
|
||||
|
@ -464,10 +465,16 @@ def main():
|
|||
end_state = existing
|
||||
|
||||
if state == 'absent' and existing['addresses']:
|
||||
if version == 'v6':
|
||||
for address in existing['addresses']:
|
||||
if address['addr'] == addr and address['mask'] == mask:
|
||||
command = get_remove_ip_config_commands(interface, addr, mask,
|
||||
version)
|
||||
command = get_remove_ip_config_commands(interface, addr,
|
||||
mask, version)
|
||||
commands.append(command)
|
||||
|
||||
else:
|
||||
command = get_remove_ip_config_commands(interface, addr,
|
||||
mask, version)
|
||||
commands.append(command)
|
||||
|
||||
elif state == 'present':
|
||||
|
|
Loading…
Reference in a new issue