Skip to content

Commit

Permalink
changed one version in req. Removed a hardcoded 'node' statement, and…
Browse files Browse the repository at this point in the history
… changed json commands to imported statements
  • Loading branch information
erik-leven committed Jun 16, 2020
1 parent 64c2ccd commit 391932b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions service/github-autodeployer.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,31 +289,31 @@ def check_for_unknown():
def check_and_replace_orchestrator_pipes():
for old_filename in os.listdir(sesam_checkout_dir + "/unpacked/pipes/"):
with open(os.path.join(sesam_checkout_dir + "/unpacked/pipes/", old_filename), 'r') as f: # open in readonly mode
old_file = json.loads(f.read())
old_file = load_json(f.read())
try:
old_file["metadata"]["orchestrator"]["original_configuration"]
for new_filename in os.listdir(git_cloned_dir + "/sesam-node/pipes/"):
with open(os.path.join(git_cloned_dir + "/sesam-node/pipes/", new_filename), 'r') as g: # open in readonly mode
new_file = json.loads(g.read())
new_file = load_json(g.read())
if old_file["metadata"]["orchestrator"]["original_configuration"] == new_file:
logging.info("The pipe %s is restored to orchestrator mode" % new_file["_id"])
with open(os.path.join(payload_dir + "/pipes/", new_filename), 'w') as h:
h.write(json.dumps(old_file))
h.write(dump_json(old_file))
except KeyError:
None
def check_and_replace_orchestrator_systems():
for old_filename in os.listdir(sesam_checkout_dir + "/unpacked/systems/"):
with open(os.path.join(sesam_checkout_dir + "/unpacked/systems/", old_filename), 'r') as f: # open in readonly mode
old_file = json.loads(f.read())
old_file = load_json(f.read())
try:
old_file["metadata"]["orchestrator"]["original_configuration"]
for new_filename in os.listdir(git_cloned_dir + "/sesam-node/systems/"):
with open(os.path.join(git_cloned_dir + "/sesam-node/systems/", new_filename), 'r') as g: # open in readonly mode
new_file = json.loads(g.read())
new_file = load_json(g.read())
if old_file["metadata"]["orchestrator"]["original_configuration"] == new_file:
logging.info("The system %s is restored to orchestrator mode" % new_file["_id"])
with open(os.path.join(payload_dir + "/systems/", new_filename), 'w') as h:
h.write(json.dumps(old_file))
h.write(dump_json(old_file))
except KeyError:
None

Expand All @@ -334,7 +334,7 @@ def check_and_replace_orchestrator_systems():
check_for_unknown()
copy_autodeployer()

new_node = load_sesam_files_as_json(git_cloned_dir + "/" + sync_root + '/node')
new_node = load_sesam_files_as_json(git_cloned_dir + "/" + sync_root)
old_node = load_sesam_files_as_json(sesam_checkout_dir + "/" + "unpacked")
if not compare_json_dict_list(old_node, new_node):
# Verify variables & secrets if specified
Expand Down
4 changes: 2 additions & 2 deletions service/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
requests==2.20.0
PyGithub==1.35
GitPython==2.1.8
hvac==0.9.6
GitPython==3.0.6
hvac==0.9.6

0 comments on commit 391932b

Please sign in to comment.