DRY
authorAlyssa Rosenzweig <alyssa@rosenzweig.io>
Mon, 25 Jun 2018 18:38:38 +0000 (14:38 -0400)
committerAlyssa Rosenzweig <alyssa@rosenzweig.io>
Mon, 25 Jun 2018 18:38:38 +0000 (14:38 -0400)
libremanage.py

index c56f12c9a5480513714db26a5ece5c380e575e2d..105ff33b3996827c0ebe3c032a3b00f0f4522b53 100644 (file)
@@ -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):