Merge branch 'thingos-next' into dev

This commit is contained in:
Calin Crisan 2019-01-27 15:40:03 +02:00
commit a4092b77e4
3 changed files with 32 additions and 32 deletions

View File

@ -80,19 +80,19 @@ def _get_date_settings():
except:
continue
if name == 'date_method':
if name == 'DATE_METHOD':
date_method = value
elif name == 'date_host':
elif name == 'DATE_HOST':
date_host = value
elif name == 'date_ntp_server':
elif name == 'DATE_NTP_SERVER':
date_ntp_server = value
elif name == 'date_timeout':
elif name == 'DATE_TIMEOUT':
date_timeout = int(value)
elif name == 'date_interval':
elif name == 'DATE_INTERVAL':
date_interval = int(value)
s = {
@ -119,11 +119,11 @@ def _set_date_settings(s):
'method=%(dateMethod)s, host=%(dateHost)s, ntp_server=%(dateNtpServer)s, timeout=%(dateTimeout)s, interval=%(dateInterval)s' % s)
with open(DATE_CONF, 'w') as f:
f.write('date_method=%s\n' % s['dateMethod'])
f.write('date_host=%s\n' % s['dateHost'])
f.write('date_ntp_server=%s\n' % s['dateNtpServer'])
f.write('date_timeout=%s\n' % s['dateTimeout'])
f.write('date_interval=%s\n' % s['dateInterval'])
f.write('DATE_METHOD=%s\n' % s['dateMethod'])
f.write('DATE_HOST=%s\n' % s['dateHost'])
f.write('DATE_NTP_SERVER=%s\n' % s['dateNtpServer'])
f.write('DATE_TIMEOUT=%s\n' % s['dateTimeout'])
f.write('DATE_INTERVAL=%s\n' % s['dateInterval'])
def _get_os_settings():

View File

@ -52,19 +52,19 @@ def _get_ip_settings():
if not line:
continue
match = re.match('^static_ip="(.*)/(.*)"$', line)
match = re.match('^STATIC_IP="(.*)/(.*)"$', line)
if match:
ip, cidr = match.groups()
ip_comment = comment
continue
match = re.match('^static_gw="(.*)"$', line)
match = re.match('^STATIC_GW="(.*)"$', line)
if match:
gw = match.group(1)
gw_comment = comment
continue
match = re.match('^static_dns="(.*)"$', line)
match = re.match('^STATIC_DNS="(.*)"$', line)
if match:
dns = match.group(1)
dns_comment = comment
@ -138,9 +138,9 @@ def _set_ip_settings(s):
current_settings[key] = (value, True)
enabled = type != 'dhcp'
current_settings['static_ip'] = ('"%s/%s"' % (ip, cidr), enabled)
current_settings['static_gw'] = ('"%s"' % gw, enabled)
current_settings['static_dns'] = ('"%s"' % dns, enabled)
current_settings['STATIC_IP'] = ('"%s/%s"' % (ip, cidr), enabled)
current_settings['STATIC_GW'] = ('"%s"' % gw, enabled)
current_settings['STATIC_DNS'] = ('"%s"' % dns, enabled)
with open(STATIC_IP_CONF, 'w') as f:
for key, value in current_settings.items():

View File

@ -56,26 +56,26 @@ def _get_watch_settings():
except:
continue
if name == 'link_watch':
if name == 'LINK_WATCH':
watch_link = (value == 'true') and not comment
elif name == 'link_watch_timeout':
elif name == 'LINK_WATCH_TIMEOUT':
watch_link_timeout = int(value)
elif name == 'netwatch_host':
elif name == 'NETWATCH_HOST':
watch_connect = not comment
watch_connect_host = value
elif name == 'netwatch_port':
elif name == 'NETWATCH_PORT':
watch_connect_port = int(value)
elif name == 'netwatch_timeout':
elif name == 'NETWATCH_TIMEOUT':
watch_connect_timeout = int(value)
elif name == 'netwatch_retries':
elif name == 'NETWATCH_RETRIES':
watch_connect_retries = int(value)
elif name == 'netwatch_interval':
elif name == 'NETWATCH_INTERVAL':
watch_connect_interval = int(value)
s = {
@ -115,17 +115,17 @@ def _set_watch_settings(s):
with open(WATCH_CONF, 'w') as f:
f.write('link_watch=%s\n' % ['"false"', '"true"'][s['watchLink']])
f.write('link_watch_timeout=%s\n' % s['watchLinkTimeout'])
f.write('LINK_WATCH=%s\n' % ['"false"', '"true"'][s['watchLink']])
f.write('LINK_WATCH_TIMEOUT=%s\n' % s['watchLinkTimeout'])
f.write('\n')
f.write('ip_watch=%s\n' % ['"false"', '"true"'][s['watchLink']])
f.write('ip_watch_timeout=%s\n' % s['watchLinkTimeout'])
f.write('IP_WATCH=%s\n' % ['"false"', '"true"'][s['watchLink']])
f.write('IP_WATCH_TIMEOUT=%s\n' % s['watchLinkTimeout'])
f.write('\n')
f.write('%snetwatch_host=%s\n' % (('#' if not s['watchConnect'] else ''), s['watchConnectHost']))
f.write('netwatch_port=%s\n' % s['watchConnectPort'])
f.write('netwatch_retries=%s\n' % s['watchConnectRetries'])
f.write('netwatch_timeout=%s\n' % s['watchConnectTimeout'])
f.write('netwatch_interval=%s\n' % s['watchConnectInterval'])
f.write('%sNETWATCH_HOST=%s\n' % (('#' if not s['watchConnect'] else ''), s['watchConnectHost']))
f.write('NETWATCH_PORT=%s\n' % s['watchConnectPort'])
f.write('NETWATCH_RETRIES=%s\n' % s['watchConnectRetries'])
f.write('NETWATCH_TIMEOUT=%s\n' % s['watchConnectTimeout'])
f.write('NETWATCH_INTERVAL=%s\n' % s['watchConnectInterval'])
@additional_section