From 1b48db8483a9ea99e0c2c1daff4ab9349ba42a30 Mon Sep 17 00:00:00 2001 From: Alex Iribarren <Alex.Iribarren@cern.ch> Date: Tue, 18 Sep 2018 16:33:25 +0200 Subject: [PATCH] Let Nomad get it's own tokens --- scheduler/Dockerfile | 2 +- scheduler/schedule.py | 30 ------------------------------ 2 files changed, 1 insertion(+), 31 deletions(-) diff --git a/scheduler/Dockerfile b/scheduler/Dockerfile index 0d0a3b5..82e8cae 100644 --- a/scheduler/Dockerfile +++ b/scheduler/Dockerfile @@ -3,7 +3,7 @@ FROM cern/cc7-base # Install my own python-nomad until the upstream one is fixed RUN yum install -y jq python-pip \ && pip install https://github.com/alexiri/python-nomad/archive/master.zip \ - && pip install hvac pyyaml configparser \ + && pip install pyyaml configparser \ && yum clean all RUN rm -rf /etc/yum.repos.d diff --git a/scheduler/schedule.py b/scheduler/schedule.py index de2dfa0..7e0de5c 100755 --- a/scheduler/schedule.py +++ b/scheduler/schedule.py @@ -1,6 +1,5 @@ #!/usr/bin/python -import hvac import nomad from nomad.api import exceptions import yaml @@ -35,35 +34,6 @@ def error(**kwargs): kwargs.update({'message_type': 'error'}) log(**kwargs) -print('environment: {}'.format(os.environ)) -from os import walk -files = [] -for r, d, f in os.walk(os.getenv('NOMAD_SECRETS_DIR', '.')): - print('files: {}'.format(f)) - print('dirs: {}'.format(d)) - for file in f: - print('-- {}:'.format(file)) - try: - of = open(os.path.join(r, file)) - print(of.readlines()) - of.close() - except Exception as e: - print('error with {}: {}'.format(file, e)) - - -#debug(message='Connecting to Vault at: {}'.format(os.getenv('VAULT_ADDR', None))) -#client = hvac.Client(url=os.environ['VAULT_ADDR'], token=os.environ['VAULT_TOKEN'], verify=False) - -#if not client.is_authenticated(): -# error(message='Vault authentication failed!') -# sys.exit(1) - -#current_token = client.lookup_token() -#print('vault token: {}'.format(current_token)) - -#token = client.read('nomad/creds/write') -#print('nomad token: {}'.format(token)) - try: nomad_token = os.environ['NOMAD_TOKEN'] except KeyError: -- GitLab