Fixing white space issue with cmd, and making internal default to False

This commit is contained in:
Kai Meyer 2016-12-20 16:06:06 -07:00
parent 43b2bec26f
commit 64b64f9ee7

View File

@ -335,7 +335,7 @@ def interface_get_type(port):
return _stdout_list_split(retcode, stdout)
def port_create_vlan(br, port, id, internal):
def port_create_vlan(br, port, id, internal=False):
'''
Isolate VM traffic using VLANs.
@ -364,14 +364,14 @@ def port_create_vlan(br, port, id, internal):
return False
elif port in port_list(br):
cmd = 'ovs-vsctl set port {0} tag={1}'.format(port, id)
if internal:
cmd += ' -- set interface {0} type=internal'.format(port)
if internal:
cmd += ' -- set interface {0} type=internal'.format(port)
result = __salt__['cmd.run_all'](cmd)
return _retcode_to_bool(result['retcode'])
else:
cmd = 'ovs-vsctl add-port {0} {1} tag={2}'.format(br, port, id)
if internal:
cmd += ' -- set interface {0} type=internal'.format(port)
if internal:
cmd += ' -- set interface {0} type=internal'.format(port)
result = __salt__['cmd.run_all'](cmd)
return _retcode_to_bool(result['retcode'])