]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
Move teuthology-updatekeys' arg parsing to scripts/
authorZack Cerza <zack@cerza.org>
Tue, 8 Oct 2013 22:02:47 +0000 (17:02 -0500)
committerZack Cerza <zack@cerza.org>
Fri, 11 Oct 2013 00:09:34 +0000 (19:09 -0500)
Signed-off-by: Zack Cerza <zack.cerza@inktank.com>
scripts/updatekeys.py [new file with mode: 0644]
setup.py
teuthology/lock.py

diff --git a/scripts/updatekeys.py b/scripts/updatekeys.py
new file mode 100644 (file)
index 0000000..364ac40
--- /dev/null
@@ -0,0 +1,40 @@
+import argparse
+
+import teuthology.lock
+
+
+def main():
+    teuthology.lock.updatekeys(parse_args())
+
+
+def parse_args():
+    parser = argparse.ArgumentParser(description="""
+Update any hostkeys that have changed. You can list specific machines
+to run on, or use -a to check all of them automatically.
+""")
+    parser.add_argument(
+        '-t', '--targets',
+        default=None,
+        help='input yaml containing targets to check',
+    )
+    parser.add_argument(
+        'machines',
+        metavar='MACHINES',
+        default=[],
+        nargs='*',
+        help='hosts to check for updated keys',
+    )
+    parser.add_argument(
+        '-v', '--verbose',
+        action='store_true',
+        default=False,
+        help='be more verbose',
+    )
+    parser.add_argument(
+        '-a', '--all',
+        action='store_true',
+        default=False,
+        help='update hostkeys of all machines in the db',
+    )
+
+    return parser.parse_args()
index f97c9a220d8834d33b757b106988843a76e06bae..d926cf2131aa42e9821187b4d036565cac821c1a 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -23,7 +23,7 @@ setup(
             'teuthology-worker = scripts.worker:main',
             'teuthology-lock = scripts.lock:main',
             'teuthology-schedule = scripts.schedule:main',
-            'teuthology-updatekeys = teuthology.lock:update_hostkeys',
+            'teuthology-updatekeys = scripts.updatekeys:main',
             'teuthology-coverage = teuthology.coverage:analyze',
             'teuthology-results = teuthology.suite:results',
             'teuthology-report = teuthology.report:main',
index a0c8ce46665edf0d34d8e6e9885468329e2e1261..79dd127c3bfcf9a134b00d5013e54499c7902c5f 100644 (file)
@@ -306,38 +306,7 @@ def main(ctx):
     return ret
 
 
-def update_hostkeys():
-    parser = argparse.ArgumentParser(description="""
-Update any hostkeys that have changed. You can list specific machines
-to run on, or use -a to check all of them automatically.
-""")
-    parser.add_argument(
-        '-t', '--targets',
-        default=None,
-        help='input yaml containing targets to check',
-    )
-    parser.add_argument(
-        'machines',
-        metavar='MACHINES',
-        default=[],
-        nargs='*',
-        help='hosts to check for updated keys',
-    )
-    parser.add_argument(
-        '-v', '--verbose',
-        action='store_true',
-        default=False,
-        help='be more verbose',
-    )
-    parser.add_argument(
-        '-a', '--all',
-        action='store_true',
-        default=False,
-        help='update hostkeys of all machines in the db',
-    )
-
-    ctx = parser.parse_args()
-
+def updatekeys(ctx):
     loglevel = logging.INFO
     if ctx.verbose:
         loglevel = logging.DEBUG