|
|
@ -120,15 +120,14 @@ def map_obj_to_commands(want, have, module):
|
|
|
|
"%(col)s"
|
|
|
|
"%(col)s"
|
|
|
|
commands.append(templatized_command % module.params)
|
|
|
|
commands.append(templatized_command % module.params)
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
|
|
|
|
if want == have:
|
|
|
|
|
|
|
|
# Nothing to commit
|
|
|
|
|
|
|
|
return commands
|
|
|
|
if module.params['key'] is None:
|
|
|
|
if module.params['key'] is None:
|
|
|
|
templatized_command = "%(ovs-vsctl)s -t %(timeout)s set %(table)s %(record)s " \
|
|
|
|
templatized_command = "%(ovs-vsctl)s -t %(timeout)s set %(table)s %(record)s " \
|
|
|
|
"%(col)s=%(value)s"
|
|
|
|
"%(col)s=%(value)s"
|
|
|
|
commands.append(templatized_command % module.params)
|
|
|
|
commands.append(templatized_command % module.params)
|
|
|
|
elif 'key' not in have.keys():
|
|
|
|
else:
|
|
|
|
templatized_command = "%(ovs-vsctl)s -t %(timeout)s add %(table)s %(record)s " \
|
|
|
|
|
|
|
|
"%(col)s %(key)s=%(value)s"
|
|
|
|
|
|
|
|
commands.append(templatized_command % module.params)
|
|
|
|
|
|
|
|
elif want['value'] != have['value']:
|
|
|
|
|
|
|
|
templatized_command = "%(ovs-vsctl)s -t %(timeout)s set %(table)s %(record)s " \
|
|
|
|
templatized_command = "%(ovs-vsctl)s -t %(timeout)s set %(table)s %(record)s " \
|
|
|
|
"%(col)s:%(key)s=%(value)s"
|
|
|
|
"%(col)s:%(key)s=%(value)s"
|
|
|
|
commands.append(templatized_command % module.params)
|
|
|
|
commands.append(templatized_command % module.params)
|
|
|
@ -171,7 +170,7 @@ def map_config_to_obj(module):
|
|
|
|
obj['key'] = module.params['key']
|
|
|
|
obj['key'] = module.params['key']
|
|
|
|
obj['value'] = col_value_to_dict[module.params['key']]
|
|
|
|
obj['value'] = col_value_to_dict[module.params['key']]
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
obj['value'] = col_value.strip()
|
|
|
|
obj['value'] = str(col_value.strip())
|
|
|
|
|
|
|
|
|
|
|
|
return obj
|
|
|
|
return obj
|
|
|
|
|
|
|
|
|
|
|
@ -199,7 +198,7 @@ def main():
|
|
|
|
'record': {'required': True},
|
|
|
|
'record': {'required': True},
|
|
|
|
'col': {'required': True},
|
|
|
|
'col': {'required': True},
|
|
|
|
'key': {'required': False},
|
|
|
|
'key': {'required': False},
|
|
|
|
'value': {'required': True},
|
|
|
|
'value': {'required': True, 'type': 'str'},
|
|
|
|
'timeout': {'default': 5, 'type': 'int'},
|
|
|
|
'timeout': {'default': 5, 'type': 'int'},
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|