diff --git a/plugins/cron/layout/main.xml b/plugins/cron/layout/main.xml index bc9f2f0402..c7e3afd293 100644 --- a/plugins/cron/layout/main.xml +++ b/plugins/cron/layout/main.xml @@ -2,7 +2,7 @@ - +
diff --git a/plugins/dnsmasq/backend.py b/plugins/dnsmasq/backend.py index 830fef8722..847a150926 100644 --- a/plugins/dnsmasq/backend.py +++ b/plugins/dnsmasq/backend.py @@ -36,8 +36,8 @@ def get_config(self): if k == 'dhcp-host': r['dhcp-hosts'].append(self.parse_host(v)) - elif k == 'domain': - r['domains'].append(v) + elif k == 'address': + r['domains'].append(v.split('/')) else: r['opts'][k] = v else: @@ -45,6 +45,38 @@ def get_config(self): r['opts'][k] = None return r + def save_config(self, cfg): + s = '' + s += '# Hosts\n' + for x in cfg['dhcp-hosts']: + v = [] + for y in x['id']: + if y[0] == 'dhcpid': + v.append('id:'+y[1]) + else: + v.append(y[1]) + for y in x['act']: + if y[0] == 'ignore': + v.append(y[0]) + elif y[0] == 'set': + v.append('set:' + y[1]) + else: + v.append(y[1]) + s += 'dhcp-host=' + ','.join(v) + '\n' + + s += '\n\n# Domains\n' + for x in cfg['domains']: + s += 'address=' + '/'.join(x) + '\n' + + s += '\n\n# Other options\n' + for x in cfg['opts']: + if cfg['opts'][x]: + s += '%s=%s\n' % (x, cfg['opts'][x]) + else: + s += x + '\n' + + open(self.config_file, 'w').write(s) + def parse_host(self, s): r = { 'id': [], 'act': [] } s = s.split(',') @@ -95,7 +127,7 @@ def str_act(self, h): r = [] for x in h: if x[0] == 'set': - r.append('apply option set %s' % x[1]) + r.append('use tag %s' % x[1]) if x[0] == 'ignore': r.append('ignore') if x[0] == 'name': diff --git a/plugins/dnsmasq/layout/edit-host.xml b/plugins/dnsmasq/layout/edit-host.xml new file mode 100644 index 0000000000..66149fb3c7 --- /dev/null +++ b/plugins/dnsmasq/layout/edit-host.xml @@ -0,0 +1,73 @@ + + + + diff --git a/plugins/dnsmasq/layout/main.xml b/plugins/dnsmasq/layout/main.xml index 94b3fea45f..8b2eef28b0 100644 --- a/plugins/dnsmasq/layout/main.xml +++ b/plugins/dnsmasq/layout/main.xml @@ -1,8 +1,12 @@ + + + +