From d08f2add7644750f93f8c0d020a310bb72e4515b Mon Sep 17 00:00:00 2001 From: Mike khiretskiy Date: Wed, 18 Dec 2013 10:06:01 +0400 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=BE=20=D0=B8=D1=81=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE?= =?UTF-8?q?=D0=B2=D0=B0=D0=BD=D0=B8=D0=B5=20=D0=BF=D0=B5=D1=80=D0=B5=D0=BC?= =?UTF-8?q?=D0=B5=D0=BD=D0=BD=D0=BE=D0=B9=20cl=5Fcore=5Fport=20=D0=B4?= =?UTF-8?q?=D0=BB=D1=8F=20=D0=BF=D0=BE=D1=80=D1=82=D0=B0=20=D0=BF=D0=BE=20?= =?UTF-8?q?=D1=83=D0=BC=D0=BE=D0=BB=D1=87=D0=B0=D0=BD=D0=B8=D1=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- console/application/cert_func.py | 17 ++++++++++++----- console/application/cl_client.py | 3 ++- console/application/methods_func.py | 2 +- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/console/application/cert_func.py b/console/application/cert_func.py index 32dcd80..7ee84bc 100644 --- a/console/application/cert_func.py +++ b/console/application/cert_func.py @@ -127,8 +127,13 @@ def client_post_request (cert_path, args): ans = raw_input (_("Send a new request? y/[n]: ")) if not ans.lower() in ['y','yes']: return 0 + clVars = DataVarsCore() + clVars.importCore() + clVars.flIniFile() - url = "https://%s:%d/?wsdl" %(args.by_host, args.port) + port = args.port or clVars.Get('core.cl_core_port') + + url = "https://%s:%d/?wsdl" %(args.by_host, port) print '%s\n'% url, _("connecting...") from client_class import Client_suds try: @@ -172,6 +177,10 @@ def client_post_request (cert_path, args): return 0 def client_get_cert(cert_path, args): + clVars = DataVarsCore() + clVars.importCore() + clVars.flIniFile() + if not os.path.exists(os.path.join(cert_path, 'req_id')): print _("Request not sent or file %s deleted") \ %(os.path.join(cert_path, 'req_id')) @@ -180,7 +189,8 @@ def client_get_cert(cert_path, args): req_id = fc.read() fc.close() - url = "https://%s:%d/?wsdl" %(args.from_host, args.port) + port = args.port or clVars.Get('core.cl_core_port') + url = "https://%s:%d/?wsdl" %(args.from_host, port) print '%s\n' %url, _("connecting...") from client_class import Client_suds @@ -242,9 +252,6 @@ def client_get_cert(cert_path, args): os.chmod(cert_file, 0600) if ca_root: - clVars = DataVarsCore() - clVars.importCore() - clVars.flIniFile() system_ca_db = clVars.Get('core.cl_glob_root_cert') if os.path.exists(system_ca_db): if ca_root in open(system_ca_db, 'r').read(): diff --git a/console/application/cl_client.py b/console/application/cl_client.py index 6bb140e..84578fc 100644 --- a/console/application/cl_client.py +++ b/console/application/cl_client.py @@ -116,6 +116,7 @@ def connect_with_cert(cert, path_to_cert, url, args, wait_thread, clVarsCore, bio = M2Crypto.BIO.openfile(CERT_KEY) rsa = M2Crypto.m2.rsa_read_key(bio._ptr(),lambda *unused: None) if not rsa: + port = args.port or clVarsCore.Get('core.cl_core_port') store_passwd = get_password_from_daemon(args.host, args.port, wait_thread) if 'store_passwd' in locals(): @@ -341,7 +342,7 @@ def main(wait_thread): homePath = clVarsCore.Get('ur_home_path') - port = args.port + port = args.port or clVarsCore.GetInteger('core.cl_core_port') host = args.host path_to_cert = args.path_to_cert if not path_to_cert: diff --git a/console/application/methods_func.py b/console/application/methods_func.py index 821d483..52d0aba 100644 --- a/console/application/methods_func.py +++ b/console/application/methods_func.py @@ -37,7 +37,7 @@ def parse(): '--translate-language', type=str, dest='lang', help=_('translation language')) parser.add_argument( - '--port', type=int, default = '8888', dest='port', + '--port', type=int, dest='port', help=_('port number')) parser.add_argument( '--host', type=str, default = 'localhost', dest='host',