Skip to content
Snippets Groups Projects
Commit f4270862 authored by Antoine Millet's avatar Antoine Millet
Browse files

Added $HOSTNAME variable on login field of config file.

parent b4999a38
No related branches found
No related tags found
No related merge requests found
...@@ -10,6 +10,7 @@ import logging ...@@ -10,6 +10,7 @@ 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
try: try:
...@@ -24,7 +25,7 @@ DEFAULT_CONFIG_FILE = '/etc/cc-node.conf' ...@@ -24,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': None, 'login': '$HOSTNAME',
'password': None, 'password': None,
'port': 1984, 'port': 1984,
'verbosity': 0, 'verbosity': 0,
...@@ -65,9 +66,10 @@ def run_node(options): ...@@ -65,9 +66,10 @@ def run_node(options):
logging.info('Connected to server %s' % options['address']) logging.info('Connected to server %s' % options['address'])
def authentication(): def authentication():
login = options['login'].replace('$HOSTNAME', socket.gethostname())
while node.manager.is_running(): while node.manager.is_running():
try: try:
node.authentify(options['login'], options['password']) node.authentify(login, options['password'])
except RpcError as error: except RpcError as error:
logging.critical('Authentication error: %s' % error) logging.critical('Authentication error: %s' % error)
sleep(2) sleep(2)
......
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