fix more bugs

develop
Спиридонов Денис 12 years ago
parent fbbf1f6cbb
commit 5f9ae7eb70

@ -161,7 +161,7 @@ def client_post_request (cert_path, args):
fc = open(os.path.join(cert_path, 'req_id'), 'w') fc = open(os.path.join(cert_path, 'req_id'), 'w')
fc.write(res) fc.write(res)
fc.close() fc.close()
_print (_("Your request ID = %s") %res, _print (_("Your request ID = %s") %res + '.\n',
_("To sign the certificate in the server use command") + \ _("To sign the certificate in the server use command") + \
'\n'+'cl-core --sign-client ID_CLIENT_REQUEST') '\n'+'cl-core --sign-client ID_CLIENT_REQUEST')
return 0 return 0
@ -199,13 +199,16 @@ def client_get_cert(cert_path, args):
result = client.service.get_client_cert(req_id, md5sum) result = client.service.get_client_cert(req_id, md5sum)
cert = result[0][0] cert = result[0][0]
ca_root = result[0][1] try:
ca_root = result[0][1]
except IndexError:
ca_root = None
if cert == '1': if cert == '1':
print _('Request to sign is rejected!') print _('Request to sign is rejected!')
return 1 return 1
elif cert == '2': elif cert == '2':
print _("Signature request not reviewed yet.") print _("Signature request not reviewed yet.")
print _("Your request ID = %s") %req_id, \ print _("Your request ID = %s") %req_id + '.\n',\
_("To sign the certificate in the server use command") + \ _("To sign the certificate in the server use command") + \
'\n'+'cl-core --sign-client ID_CLIENT_REQUEST' '\n'+'cl-core --sign-client ID_CLIENT_REQUEST'
return 1 return 1

@ -202,10 +202,12 @@ def https_server(client, args, unknown_args, url, clVarsCore, wait_thread):
if args.session_info or args.session_num_info: if args.session_info or args.session_num_info:
wait_thread.stop() wait_thread.stop()
client_session_info(client, args.session_num_info) client_session_info(client, args.session_num_info)
return 0
if args.session_list: if args.session_list:
wait_thread.stop() wait_thread.stop()
client_session_list(client) client_session_list(client)
return 0
if args.list_pid: if args.list_pid:
wait_thread.stop() wait_thread.stop()

@ -116,18 +116,6 @@ def client_list_methods(client):
(results[DAT][num][RES]) < 3 else results[DAT][num][RES][TR_METH] (results[DAT][num][RES]) < 3 else results[DAT][num][RES][TR_METH]
print " %s - %s" % (view_command, meth_name) print " %s - %s" % (view_command, meth_name)
def client_list_sessions(client):
""" get all sessions on server """
results = client.service.get_sessions()
if results[0][0] == "Permission denied":
_print (results[0][0])
return 1
print _("Running sessions:")
for sess in results[0]:
_print (" - %s" %sess)
return 0
def client_pid_kill(client, pid): def client_pid_kill(client, pid):
sid = get_sid(client.SID_FILE) sid = get_sid(client.SID_FILE)

@ -89,13 +89,25 @@ def client_session_info(client, sid = None):
select_sid = sid if sid else client.sid select_sid = sid if sid else client.sid
sid_inf(client, select_sid) sid_inf(client, select_sid)
except Exception, e: except Exception, e:
print e if type (e.message) == tuple and len(e.message) == 2 \
and e.message[1] == 'Forbidden':
print _('Access Forbidden!')
else:
print e
return 1 return 1
def client_session_list(client): def client_session_list(client):
red = '\033[31m * \033[0m' red = '\033[31m * \033[0m'
green = '\033[32m * \033[0m' green = '\033[32m * \033[0m'
res = client.service.get_sessions(client.sid) try:
res = client.service.get_sessions(client.sid)
except Exception, e:
if type (e.message) == tuple and len(e.message) == 2 \
and e.message[1] == 'Forbidden':
print _('Access Forbidden!')
else:
print e
return 1
if hasattr (res, 'string'): if hasattr (res, 'string'):
if res.string: if res.string:
print _('Active sessions on the server: ') print _('Active sessions on the server: ')
@ -109,7 +121,11 @@ def session_clean(client):
try: try:
res = client.service.clear_session_cache(client.sid) res = client.service.clear_session_cache(client.sid)
except Exception, e: except Exception, e:
print e if type (e.message) == tuple and len(e.message) == 2 \
and e.message[1] == 'Forbidden':
print _('Access Forbidden!')
else:
print e
if res: if res:
print _('Error clearing session cache') print _('Error clearing session cache')
else: else:

@ -2,8 +2,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: console_gui_translate\n" "Project-Id-Version: console_gui_translate\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2012-07-05 14:24+0300\n" "POT-Creation-Date: 2012-07-09 09:43+0300\n"
"PO-Revision-Date: 2012-07-05 14:24+0300\n" "PO-Revision-Date: 2012-07-09 09:44+0300\n"
"Last-Translator: Denis Spiridonov <ds.calculate.ru>\n" "Last-Translator: Denis Spiridonov <ds.calculate.ru>\n"
"Language-Team: \n" "Language-Team: \n"
"Language: \n" "Language: \n"
@ -43,12 +43,12 @@ msgid "Process active"
msgstr "Процесс активен" msgstr "Процесс активен"
#: /var/calculate/mydir/git/calculate-console/console/application/pid_information.py:41 #: /var/calculate/mydir/git/calculate-console/console/application/pid_information.py:41
#: /var/calculate/mydir/git/calculate-console/console/application/pid_information.py:136 #: /var/calculate/mydir/git/calculate-console/console/application/pid_information.py:124
msgid "Process completed" msgid "Process completed"
msgstr "Процесс завершён" msgstr "Процесс завершён"
#: /var/calculate/mydir/git/calculate-console/console/application/pid_information.py:43 #: /var/calculate/mydir/git/calculate-console/console/application/pid_information.py:43
#: /var/calculate/mydir/git/calculate-console/console/application/pid_information.py:138 #: /var/calculate/mydir/git/calculate-console/console/application/pid_information.py:126
msgid "Process killed" msgid "Process killed"
msgstr "Процесс убит" msgstr "Процесс убит"
@ -75,27 +75,23 @@ msgstr "Вы можете запускать:"
msgid "use" msgid "use"
msgstr "используйте ключ" msgstr "используйте ключ"
#: /var/calculate/mydir/git/calculate-console/console/application/pid_information.py:126 #: /var/calculate/mydir/git/calculate-console/console/application/pid_information.py:128
msgid "Running sessions:"
msgstr "Запущенные сессии:"
#: /var/calculate/mydir/git/calculate-console/console/application/pid_information.py:140
msgid "Process not found" msgid "Process not found"
msgstr "Процесс не найден" msgstr "Процесс не найден"
#: /var/calculate/mydir/git/calculate-console/console/application/pid_information.py:142 #: /var/calculate/mydir/git/calculate-console/console/application/pid_information.py:130
#: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:266 #: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:268
#: /var/calculate/mydir/git/calculate-console/console/application/cert_func.py:43 #: /var/calculate/mydir/git/calculate-console/console/application/cert_func.py:43
msgid "Certificate not found in the server" msgid "Certificate not found in the server"
msgstr "Не найден сертификат на сервере" msgstr "Не найден сертификат на сервере"
#: /var/calculate/mydir/git/calculate-console/console/application/pid_information.py:144 #: /var/calculate/mydir/git/calculate-console/console/application/pid_information.py:132
#: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:268 #: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:270
msgid "Session not matching your certificate" msgid "Session not matching your certificate"
msgstr "Сессия не соответствует Вашему сертификату" msgstr "Сессия не соответствует Вашему сертификату"
#: /var/calculate/mydir/git/calculate-console/console/application/pid_information.py:146 #: /var/calculate/mydir/git/calculate-console/console/application/pid_information.py:134
#: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:270 #: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:272
msgid "Failed to kill the process" msgid "Failed to kill the process"
msgstr "Не удалось завершить процесс" msgstr "Не удалось завершить процесс"
@ -118,7 +114,7 @@ msgstr "Дата отзыва"
#: /var/calculate/mydir/git/calculate-console/console/application/cert_verify.py:98 #: /var/calculate/mydir/git/calculate-console/console/application/cert_verify.py:98
#: /var/calculate/mydir/git/calculate-console/console/application/cert_verify.py:103 #: /var/calculate/mydir/git/calculate-console/console/application/cert_verify.py:103
#: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:336 #: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:338
#: /var/calculate/mydir/git/calculate-console/console/application/client_class.py:287 #: /var/calculate/mydir/git/calculate-console/console/application/client_class.py:287
#, python-format #, python-format
msgid "Failed to create directory %s" msgid "Failed to create directory %s"
@ -217,42 +213,42 @@ msgstr "нет соединения с сервером!"
msgid "Not found method for %s" msgid "Not found method for %s"
msgstr "Не найден метод для %s" msgstr "Не найден метод для %s"
#: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:264 #: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:266
msgid "Process terminated" msgid "Process terminated"
msgstr "Процесс завершён" msgstr "Процесс завершён"
#: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:376 #: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:378
#: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:472 #: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:474
msgid "Invalid password" msgid "Invalid password"
msgstr "Неверный пароль" msgstr "Неверный пароль"
#: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:382 #: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:384
#: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:393 #: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:395
#: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:479 #: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:481
#: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:495 #: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:497
msgid "Error: " msgid "Error: "
msgstr "Ошибка: " msgstr "Ошибка: "
#: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:397 #: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:399
#: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:417 #: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:419
#: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:438 #: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:440
#: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:499 #: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:501
#: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:520 #: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:522
#: /var/calculate/mydir/git/calculate-console/console/application/methods_func.py:175 #: /var/calculate/mydir/git/calculate-console/console/application/methods_func.py:175
msgid "Interrupted by the user" msgid "Interrupted by the user"
msgstr "Прервано пользователем" msgstr "Прервано пользователем"
#: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:410 #: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:412
#: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:413 #: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:415
#: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:419 #: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:421
#: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:513 #: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:515
#: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:516 #: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:518
#: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:522 #: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:524
#, python-format #, python-format
msgid "Exception: %s" msgid "Exception: %s"
msgstr "Исключение: %s" msgstr "Исключение: %s"
#: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:433 #: /var/calculate/mydir/git/calculate-console/console/application/cl_client.py:435
#: /var/calculate/mydir/git/calculate-console/console/application/methods_func.py:106 #: /var/calculate/mydir/git/calculate-console/console/application/methods_func.py:106
msgid "Failed to connect" msgid "Failed to connect"
msgstr "Не удалось подключиться" msgstr "Не удалось подключиться"
@ -401,19 +397,24 @@ msgstr "Номер сертификата - %s"
msgid "Certificate issued on %s" msgid "Certificate issued on %s"
msgstr "Дата подписания сертификата - %s" msgstr "Дата подписания сертификата - %s"
#: /var/calculate/mydir/git/calculate-console/console/application/sid_func.py:101 #: /var/calculate/mydir/git/calculate-console/console/application/sid_func.py:94
#: /var/calculate/mydir/git/calculate-console/console/application/sid_func.py:107
msgid "Access Forbidden!"
msgstr "Доступ запрещён!"
#: /var/calculate/mydir/git/calculate-console/console/application/sid_func.py:113
msgid "Active sessions on the server: " msgid "Active sessions on the server: "
msgstr "Активные сессии на сервере:" msgstr "Активные сессии на сервере:"
#: /var/calculate/mydir/git/calculate-console/console/application/sid_func.py:106 #: /var/calculate/mydir/git/calculate-console/console/application/sid_func.py:118
msgid "No active session on the server" msgid "No active session on the server"
msgstr "Нет активных сессий на сервере" msgstr "Нет активных сессий на сервере"
#: /var/calculate/mydir/git/calculate-console/console/application/sid_func.py:114 #: /var/calculate/mydir/git/calculate-console/console/application/sid_func.py:126
msgid "Error clearing session cache" msgid "Error clearing session cache"
msgstr "Ошибка очистки кэша сессии" msgstr "Ошибка очистки кэша сессии"
#: /var/calculate/mydir/git/calculate-console/console/application/sid_func.py:116 #: /var/calculate/mydir/git/calculate-console/console/application/sid_func.py:128
msgid "Session cache cleared" msgid "Session cache cleared"
msgstr "Кэш сессии очищен" msgstr "Кэш сессии очищен"
@ -498,13 +499,13 @@ msgid "This server has not signed the certificate!"
msgstr "Сервер не подписал сертификат!" msgstr "Сервер не подписал сертификат!"
#: /var/calculate/mydir/git/calculate-console/console/application/cert_func.py:164 #: /var/calculate/mydir/git/calculate-console/console/application/cert_func.py:164
#: /var/calculate/mydir/git/calculate-console/console/application/cert_func.py:208 #: /var/calculate/mydir/git/calculate-console/console/application/cert_func.py:211
#, python-format #, python-format
msgid "Your request ID = %s" msgid "Your request ID = %s"
msgstr "Номер Вашего запроса = %s" msgstr "Номер Вашего запроса = %s"
#: /var/calculate/mydir/git/calculate-console/console/application/cert_func.py:165 #: /var/calculate/mydir/git/calculate-console/console/application/cert_func.py:165
#: /var/calculate/mydir/git/calculate-console/console/application/cert_func.py:209 #: /var/calculate/mydir/git/calculate-console/console/application/cert_func.py:212
msgid "To sign the certificate in the server use command" msgid "To sign the certificate in the server use command"
msgstr "Для подписания сертификата на сервере используется команда" msgstr "Для подписания сертификата на сервере используется команда"
@ -518,52 +519,52 @@ msgstr "Запрос не был послан или удалён файл %s"
msgid "Request %s not found on the client's side" msgid "Request %s not found on the client's side"
msgstr "Запрос %s не найден на стороне клиента" msgstr "Запрос %s не найден на стороне клиента"
#: /var/calculate/mydir/git/calculate-console/console/application/cert_func.py:204 #: /var/calculate/mydir/git/calculate-console/console/application/cert_func.py:207
msgid "Request to sign is rejected!" msgid "Request to sign is rejected!"
msgstr "Запрос на подпись сертификата отвергнут!" msgstr "Запрос на подпись сертификата отвергнут!"
#: /var/calculate/mydir/git/calculate-console/console/application/cert_func.py:207 #: /var/calculate/mydir/git/calculate-console/console/application/cert_func.py:210
msgid "Signature request not reviewed yet." msgid "Signature request not reviewed yet."
msgstr "Запрос на подписание сертификата ещё не рассмотрен." msgstr "Запрос на подписание сертификата ещё не рассмотрен."
#: /var/calculate/mydir/git/calculate-console/console/application/cert_func.py:213 #: /var/calculate/mydir/git/calculate-console/console/application/cert_func.py:216
msgid "Signature request does not match earlier data." msgid "Signature request does not match earlier data."
msgstr "Запрос или подпись не соответствуют отправленным ранее." msgstr "Запрос или подпись не соответствуют отправленным ранее."
#: /var/calculate/mydir/git/calculate-console/console/application/cert_func.py:216 #: /var/calculate/mydir/git/calculate-console/console/application/cert_func.py:219
msgid "The request was sent from another IP." msgid "The request was sent from another IP."
msgstr "Запрос был послан с другого адреса." msgstr "Запрос был послан с другого адреса."
#: /var/calculate/mydir/git/calculate-console/console/application/cert_func.py:226 #: /var/calculate/mydir/git/calculate-console/console/application/cert_func.py:229
#, python-format #, python-format
msgid "Certificate save. Your certificate id - %s" msgid "Certificate save. Your certificate id - %s"
msgstr "Сертификат сохранён. Номер вашего сертификата - %s" msgstr "Сертификат сохранён. Номер вашего сертификата - %s"
#: /var/calculate/mydir/git/calculate-console/console/application/cert_func.py:283 #: /var/calculate/mydir/git/calculate-console/console/application/cert_func.py:286
#: /var/calculate/mydir/git/calculate-console/console/application/client_class.py:170 #: /var/calculate/mydir/git/calculate-console/console/application/client_class.py:170
msgid "Field \"CN\" not found in the certificate!" msgid "Field \"CN\" not found in the certificate!"
msgstr "Не найдено поле \"CN\" в сертификате!" msgstr "Не найдено поле \"CN\" в сертификате!"
#: /var/calculate/mydir/git/calculate-console/console/application/cert_func.py:296 #: /var/calculate/mydir/git/calculate-console/console/application/cert_func.py:299
#: /var/calculate/mydir/git/calculate-console/console/application/client_class.py:180 #: /var/calculate/mydir/git/calculate-console/console/application/client_class.py:180
msgid "filename = " msgid "filename = "
msgstr "Имя файла =" msgstr "Имя файла ="
#: /var/calculate/mydir/git/calculate-console/console/application/cert_func.py:297 #: /var/calculate/mydir/git/calculate-console/console/application/cert_func.py:300
#: /var/calculate/mydir/git/calculate-console/console/application/client_class.py:181 #: /var/calculate/mydir/git/calculate-console/console/application/client_class.py:181
msgid "Certificate added" msgid "Certificate added"
msgstr "Сертификат добавлен" msgstr "Сертификат добавлен"
#: /var/calculate/mydir/git/calculate-console/console/application/cert_func.py:299 #: /var/calculate/mydir/git/calculate-console/console/application/cert_func.py:302
#: /var/calculate/mydir/git/calculate-console/console/application/client_class.py:183 #: /var/calculate/mydir/git/calculate-console/console/application/client_class.py:183
msgid "A file with CA certificates now exists" msgid "A file with CA certificates now exists"
msgstr "Файл с сертификатом удостоверяющего центра создан" msgstr "Файл с сертификатом удостоверяющего центра создан"
#: /var/calculate/mydir/git/calculate-console/console/application/cert_func.py:311 #: /var/calculate/mydir/git/calculate-console/console/application/cert_func.py:314
msgid "You do not have a certificate. Use --gen-cert-by HOST to generate new request or --get-cert-from HOST to get a new certificate from the server." msgid "You do not have a certificate. Use --gen-cert-by HOST to generate new request or --get-cert-from HOST to get a new certificate from the server."
msgstr "У Вас нет сертификата. Используйте ключ --gen-cert-by HOST для генерации запроса на сертитфикат или ключ --get-cert-from HOST чтобы забрать сертификат с сервера." msgstr "У Вас нет сертификата. Используйте ключ --gen-cert-by HOST для генерации запроса на сертитфикат или ключ --get-cert-from HOST чтобы забрать сертификат с сервера."
#: /var/calculate/mydir/git/calculate-console/console/application/cert_func.py:383 #: /var/calculate/mydir/git/calculate-console/console/application/cert_func.py:386
msgid "Password: " msgid "Password: "
msgstr "Пароль: " msgstr "Пароль: "
@ -640,6 +641,9 @@ msgstr "Добавить Корневой и сертификат ЦА"
msgid "This server is not trusted" msgid "This server is not trusted"
msgstr "Сервер не является доверенным" msgstr "Сервер не является доверенным"
#~ msgid "Running sessions:"
#~ msgstr "Запущенные сессии:"
#~ msgid "Process name - %s" #~ msgid "Process name - %s"
#~ msgstr "Имя процесса - %s" #~ msgstr "Имя процесса - %s"

@ -33,5 +33,5 @@ if __name__=='__main__':
except KeyboardInterrupt: except KeyboardInterrupt:
wait_thread.stop() wait_thread.stop()
red = '\033[31m * \033[0m' red = '\033[31m * \033[0m'
print '\n'+red+_('Interrupted by user') print '\n'+red+_('Interrupted by the user')
sys.exit(1) sys.exit(1)
Loading…
Cancel
Save