mirror of
https://github.com/valitydev/salt.git
synced 2024-11-08 01:18:58 +00:00
single quotes
This commit is contained in:
parent
7a17804653
commit
f360aa53b6
@ -207,8 +207,8 @@ def _parse_interfaces():
|
|||||||
#if os.path.exists("/etc/network/interfaces.d/"):
|
#if os.path.exists("/etc/network/interfaces.d/"):
|
||||||
# interface_files += os.listdir("/etc/network/interfaces.d/")
|
# interface_files += os.listdir("/etc/network/interfaces.d/")
|
||||||
|
|
||||||
if os.path.isfile("/etc/network/interfaces"):
|
if os.path.isfile('/etc/network/interfaces'):
|
||||||
interface_files.insert(0, "/etc/network/interfaces")
|
interface_files.insert(0, '/etc/network/interfaces')
|
||||||
|
|
||||||
adapters = {}
|
adapters = {}
|
||||||
context = -1
|
context = -1
|
||||||
@ -272,7 +272,7 @@ def _parse_interfaces():
|
|||||||
if sline[0].startswith('bond') == True:
|
if sline[0].startswith('bond') == True:
|
||||||
opt = sline[0].split('_', 1)[1]
|
opt = sline[0].split('_', 1)[1]
|
||||||
sline.pop(0)
|
sline.pop(0)
|
||||||
value = " ".join(sline)
|
value = ' '.join(sline)
|
||||||
|
|
||||||
if not adapters[iface_name].has_key('bonding'):
|
if not adapters[iface_name].has_key('bonding'):
|
||||||
adapters[iface_name]['bonding'] = {}
|
adapters[iface_name]['bonding'] = {}
|
||||||
@ -281,7 +281,7 @@ def _parse_interfaces():
|
|||||||
if sline[0].startswith('bridge') == True:
|
if sline[0].startswith('bridge') == True:
|
||||||
opt = sline[0].split('_', 1)[1]
|
opt = sline[0].split('_', 1)[1]
|
||||||
sline.pop(0)
|
sline.pop(0)
|
||||||
value = " ".join(sline)
|
value = ' '.join(sline)
|
||||||
|
|
||||||
if not adapters[iface_name]['data'][context].has_key('bridge_options'):
|
if not adapters[iface_name]['data'][context].has_key('bridge_options'):
|
||||||
adapters[iface_name]['data'][context]['bridge_options'] = {}
|
adapters[iface_name]['data'][context]['bridge_options'] = {}
|
||||||
@ -290,7 +290,7 @@ def _parse_interfaces():
|
|||||||
if sline[0] in ['up', 'down', 'pre-up', 'post-up', 'pre-down', 'post-down']:
|
if sline[0] in ['up', 'down', 'pre-up', 'post-up', 'pre-down', 'post-down']:
|
||||||
ud = sline.pop(0)
|
ud = sline.pop(0)
|
||||||
cmd = ' '.join(sline)
|
cmd = ' '.join(sline)
|
||||||
cmd_key = "%s_cmds" % (re.sub('-', '_', ud))
|
cmd_key = '%s_cmds' % (re.sub('-', '_', ud))
|
||||||
if not adapters[iface_name]['data'][context].has_key(cmd_key):
|
if not adapters[iface_name]['data'][context].has_key(cmd_key):
|
||||||
adapters[iface_name]['data'][context][cmd_key] = []
|
adapters[iface_name]['data'][context][cmd_key] = []
|
||||||
adapters[iface_name]['data'][context][cmd_key].append(cmd)
|
adapters[iface_name]['data'][context][cmd_key].append(cmd)
|
||||||
@ -761,7 +761,7 @@ def _parse_settings_eth(opts, iface_type, enabled, iface):
|
|||||||
if enabled:
|
if enabled:
|
||||||
adapters[iface]['enabled'] = True
|
adapters[iface]['enabled'] = True
|
||||||
|
|
||||||
adapters[iface]['data'][0]['inet_type'] = "inet"
|
adapters[iface]['data'][0]['inet_type'] = 'inet'
|
||||||
|
|
||||||
if iface_type not in ['bridge']:
|
if iface_type not in ['bridge']:
|
||||||
tmp_ethtool = _parse_ethtool_opts(opts, iface)
|
tmp_ethtool = _parse_ethtool_opts(opts, iface)
|
||||||
@ -784,7 +784,7 @@ def _parse_settings_eth(opts, iface_type, enabled, iface):
|
|||||||
adapters[iface]['master'] = opts['master']
|
adapters[iface]['master'] = opts['master']
|
||||||
|
|
||||||
if iface_type == 'vlan':
|
if iface_type == 'vlan':
|
||||||
adapters[iface]['data'][0]['vlan_raw_device'] = re.sub("\.\d*", "", iface)
|
adapters[iface]['data'][0]['vlan_raw_device'] = re.sub('\.\d*', '', iface)
|
||||||
|
|
||||||
if 'proto' in opts:
|
if 'proto' in opts:
|
||||||
valid = ['bootp', 'dhcp', 'none', 'static', 'manual', 'loopback']
|
valid = ['bootp', 'dhcp', 'none', 'static', 'manual', 'loopback']
|
||||||
@ -821,11 +821,11 @@ def _parse_settings_eth(opts, iface_type, enabled, iface):
|
|||||||
|
|
||||||
if 'enable_ipv6' in opts and opts['enable_ipv6']:
|
if 'enable_ipv6' in opts and opts['enable_ipv6']:
|
||||||
adapters[iface]['data'].append({})
|
adapters[iface]['data'].append({})
|
||||||
adapters[iface]['data'][1]['inet_type'] = "inet6"
|
adapters[iface]['data'][1]['inet_type'] = 'inet6'
|
||||||
adapters[iface]['data'][1]['netmask'] = '64'
|
adapters[iface]['data'][1]['netmask'] = '64'
|
||||||
|
|
||||||
if 'iface_type' in opts and opts['iface_type'] == 'vlan':
|
if 'iface_type' in opts and opts['iface_type'] == 'vlan':
|
||||||
adapters[iface]['data'][1]['vlan_raw_device'] = re.sub("\.\d*", "", iface)
|
adapters[iface]['data'][1]['vlan_raw_device'] = re.sub('\.\d*', '', iface)
|
||||||
|
|
||||||
if 'ipv6proto' in opts:
|
if 'ipv6proto' in opts:
|
||||||
adapters[iface]['data'][1]['proto'] = opts['ipv6proto']
|
adapters[iface]['data'][1]['proto'] = opts['ipv6proto']
|
||||||
@ -931,7 +931,7 @@ def _write_file_ifaces(iface, data, folder):
|
|||||||
adapters = _parse_interfaces()
|
adapters = _parse_interfaces()
|
||||||
adapters[iface] = data
|
adapters[iface] = data
|
||||||
|
|
||||||
ifcfg = ""
|
ifcfg = ''
|
||||||
for adapter in adapters:
|
for adapter in adapters:
|
||||||
if adapters[adapter].has_key('type') and adapters[adapter]['type'] == 'slave':
|
if adapters[adapter].has_key('type') and adapters[adapter]['type'] == 'slave':
|
||||||
# Override values so the interfaces file is correct
|
# Override values so the interfaces file is correct
|
||||||
|
Loading…
Reference in New Issue
Block a user