From: Alyssa Rosenzweig Date: Mon, 25 Jun 2018 18:38:38 +0000 (-0400) Subject: DRY X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=28c204f999a654c0a8d0866bac19a91ef2186699;p=libremanage.git DRY --- diff --git a/libremanage.py b/libremanage.py index c56f12c..105ff33 100644 --- a/libremanage.py +++ b/libremanage.py @@ -42,7 +42,8 @@ Valid commands are as follows: with open("config.json") as f: CONFIG = json.load(f) -def open_ssh(config, command): +def open_ssh(server, command): + config = server["ssh"] subprocess.run(["ssh", config["username"] + "@" + config["host"], "-p", str(config["port"]), command]) def die_with_usage(message): @@ -74,8 +75,8 @@ COMMANDS = { # SSH sanity tests - "sanity": lambda s: open_ssh(s["ssh"], "whoami"), - "console": lambda s: open_ssh(s["ssh"], ""), + "sanity": lambda s: open_ssh(s, "whoami"), + "console": lambda s: open_ssh(s, ""), } def issue_command(server_name, command):