]> git-server-git.apps.pok.os.sepia.ceph.com Git - teuthology.git/commitdiff
Move teuthology's arg parsing to scripts/
authorZack Cerza <zack@cerza.org>
Wed, 9 Oct 2013 18:19:10 +0000 (13:19 -0500)
committerZack Cerza <zack@cerza.org>
Fri, 11 Oct 2013 00:09:35 +0000 (19:09 -0500)
Signed-off-by: Zack Cerza <zack.cerza@inktank.com>
scripts/run.py [new file with mode: 0644]
setup.py
teuthology/run.py

diff --git a/scripts/run.py b/scripts/run.py
new file mode 100644 (file)
index 0000000..a476f16
--- /dev/null
@@ -0,0 +1,67 @@
+import argparse
+
+import teuthology.run
+
+
+def main():
+    teuthology.run.main(parse_args())
+
+
+def parse_args():
+    parser = argparse.ArgumentParser(description='Run ceph integration tests')
+    parser.add_argument(
+        '-v', '--verbose',
+        action='store_true', default=None,
+        help='be more verbose',
+    )
+    parser.add_argument(
+        'config',
+        metavar='CONFFILE',
+        nargs='+',
+        type=teuthology.run.config_file,
+        action=teuthology.run.MergeConfig,
+        default={},
+        help='config file to read',
+    )
+    parser.add_argument(
+        '-a', '--archive',
+        metavar='DIR',
+        help='path to archive results in',
+    )
+    parser.add_argument(
+        '--description',
+        help='job description',
+    )
+    parser.add_argument(
+        '--owner',
+        help='job owner',
+    )
+    parser.add_argument(
+        '--lock',
+        action='store_true',
+        default=False,
+        help='lock machines for the duration of the run',
+    )
+    parser.add_argument(
+        '--machine-type',
+        default=None,
+        help='Type of machine to lock/run tests on.',
+    )
+    parser.add_argument(
+        '--os-type',
+        default='ubuntu',
+        help='Distro/OS of machine to run test on.',
+    )
+    parser.add_argument(
+        '--block',
+        action='store_true',
+        default=False,
+        help='block until locking machines succeeds (use with --lock)',
+    )
+    parser.add_argument(
+        '--name',
+        metavar='NAME',
+        help='name for this teuthology run',
+    )
+
+    return parser.parse_args()
index d1b0c56e91a89bd5db092ffe50aa3f19992f3ef2..a1cb5753a90c8e2d1502e05905a4a4ce418b3d72 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -16,7 +16,7 @@ setup(
     # and find sub foo
     entry_points={
         'console_scripts': [
-            'teuthology = teuthology.run:main',
+            'teuthology = scripts.run:main',
             'teuthology-nuke = scripts.nuke:main',
             'teuthology-suite = scripts.suite:main',
             'teuthology-ls = scripts.ls:main',
index 5832788295c21a5296cc0b7a74f2d129b940195f..e1ebab568dc73b551b34ac36cb314f51fb243d23 100644 (file)
@@ -28,67 +28,6 @@ class MergeConfig(argparse.Action):
             deep_merge(config, new)
 
 
-def parse_args():
-    parser = argparse.ArgumentParser(description='Run ceph integration tests')
-    parser.add_argument(
-        '-v', '--verbose',
-        action='store_true', default=None,
-        help='be more verbose',
-    )
-    parser.add_argument(
-        'config',
-        metavar='CONFFILE',
-        nargs='+',
-        type=config_file,
-        action=MergeConfig,
-        default={},
-        help='config file to read',
-    )
-    parser.add_argument(
-        '-a', '--archive',
-        metavar='DIR',
-        help='path to archive results in',
-    )
-    parser.add_argument(
-        '--description',
-        help='job description',
-    )
-    parser.add_argument(
-        '--owner',
-        help='job owner',
-    )
-    parser.add_argument(
-        '--lock',
-        action='store_true',
-        default=False,
-        help='lock machines for the duration of the run',
-    )
-    parser.add_argument(
-        '--machine-type',
-        default=None,
-        help='Type of machine to lock/run tests on.',
-    )
-    parser.add_argument(
-        '--os-type',
-        default='ubuntu',
-        help='Distro/OS of machine to run test on.',
-    )
-    parser.add_argument(
-        '--block',
-        action='store_true',
-        default=False,
-        help='block until locking machines succeeds (use with --lock)',
-    )
-    parser.add_argument(
-        '--name',
-        metavar='NAME',
-        help='name for this teuthology run',
-    )
-
-    args = parser.parse_args()
-    return args
-
-
 def set_up_logging(ctx):
     import logging
 
@@ -151,7 +90,7 @@ def write_initial_metadata(ctx):
             yaml.safe_dump(info, f, default_flow_style=False)
 
 
-def main():
+def main(ctx):
     from gevent import monkey
     monkey.patch_all(dns=False)
     from .orchestra import monkey
@@ -161,7 +100,6 @@ def main():
     # block. That would cause connections to hang because the monkey patching
     # hadn't been done.
     import logging
-    ctx = parse_args()
     set_up_logging(ctx)
     log = logging.getLogger(__name__)