#!/usr/bin/env python3 import sys import xmlrpc.client as client import ssl context=ssl._create_unverified_context() import os if len(sys.argv)>1: try: os.mkdir(sys.argv[1]+"n4d-vars") f=open(sys.argv[1]+"n4d-vars/vars","w") try: c=client.ServerProxy("https://localhost:9779",context=context,allow_none=True) n4dvars=c.get_variables().get('return',None) for var in n4dvars: f.write(str(var)+"\n") try: for key in n4dvars[var]: f.write("\t"+str(key)+"="+str(n4dvars[var][key])+"\n") except: f.write("\t"+str(n4dvars[var])+"\n") except Exception as e: f.write(str(e)+"\n") f.close() os.mkdir(sys.argv[1]+ "n4d-vars/varsfiles") os.system("cp -r /var/lib/n4d/ " + sys.argv[1]+ "n4d-vars/varsfiles/") except: pass