#!/usr/bin/env python3

from codecs import open as codecs_open
from xmlrpc.client import ServerProxy
import ssl

with codecs_open('/etc/n4d/key','r',encoding='utf-8') as fd:
    key = fd.readline().strip()

client = ServerProxy('https://localhost:9779',context=ssl._create_unverified_context())
result = client.get_variable(key,'VariablesManager','MASTER_SERVER_IP')
if result is not None and len(result) > 0:
    client.set_dns_master_services(key,'Dnsmasq')
