def thread_work(server_name): import pythoncom pythoncom.CoInitialize() user = conf_get_IFP(config, "GENERAL", "USER", "") password = conf_get_IFP(config, "GENERAL", "PASSWORD", "") record_only_good_config = conf_get_IFP_boolean(config, "GENERAL", "RECORD_ONLY_GOOD_CONFIG", False) from ranwinconf.common import generate_host_config generate_host_config(server_name, "%s.txt" % server_name, user, password, record_only_good_config) return True
def main(): import argparse from ranwinconf.common import generate_host_config parser = argparse.ArgumentParser() parser.add_argument('host', type=str, help="Name or IP of the host to get configuration from") parser.add_argument('--output', type=str, nargs='?', default='<stdout>', help="Output file to write the configuration, default is <stdout>") parser.add_argument('--user', type=str, nargs='?', default='', help="Name the account to use to connect to host") parser.add_argument('--pwd', type=str, nargs='?', default='', help="Password of the account to use to connect to host") args = parser.parse_args() host = args.host target = args.output user = args.user password = args.pwd generate_host_config(host, target, user, password)