Skip to content
Snippets Groups Projects
Commit eb1db518 authored by Benziane Chakib's avatar Benziane Chakib
Browse files

bug fix when authenticating and validating login in the server

parent 62d24f17
No related branches found
No related tags found
No related merge requests found
...@@ -10,7 +10,6 @@ import logging ...@@ -10,7 +10,6 @@ import logging
import logging.handlers import logging.handlers
import signal import signal
import threading import threading
import socket
from time import sleep from time import sleep
from math import exp from math import exp
...@@ -26,7 +25,7 @@ DEFAULT_CONFIG_FILE = '/etc/cc-node.conf' ...@@ -26,7 +25,7 @@ DEFAULT_CONFIG_FILE = '/etc/cc-node.conf'
DEFAULT_PID_FILE = '/var/run/cc-node.pid' DEFAULT_PID_FILE = '/var/run/cc-node.pid'
DEFAULT_CONFIGURATION = { DEFAULT_CONFIGURATION = {
'address': None, 'address': None,
'login': '$HOSTNAME', 'login': None,
'password': None, 'password': None,
'port': 1984, 'port': 1984,
'verbosity': 0, 'verbosity': 0,
...@@ -68,19 +67,16 @@ def run_node(options): ...@@ -68,19 +67,16 @@ def run_node(options):
def authentication(): def authentication():
timeout = 1 timeout = 1
login = options['login'].replace('$HOSTNAME', socket.gethostname())
while node.manager.is_running(): while node.manager.is_running():
try: result = node.authentify(options['login'], options['password'])
node.authentify(login, options['password']) if result:
except RpcError as error: logging.info('Authentication suscessfull.')
logging.critical('Authentication error: %s' % error) return
sleep(2)
else: else:
timeout += 0.1 timeout += 0.1
print exp(timeout) print exp(timeout)
sleep(exp(timeout)) sleep(exp(timeout))
logging.info('Authenticated to server')
break
def shutdown_handler(signum, frame): def shutdown_handler(signum, frame):
''' '''
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment