]> git.apps.os.sepia.ceph.com Git - teuthology.git/commitdiff
Move teuthology-suite's arg parsing to scripts/
authorZack Cerza <zack@cerza.org>
Tue, 8 Oct 2013 16:34:09 +0000 (11:34 -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/suite.py [new file with mode: 0644]
setup.py
teuthology/suite.py

diff --git a/scripts/suite.py b/scripts/suite.py
new file mode 100644 (file)
index 0000000..d987096
--- /dev/null
@@ -0,0 +1,85 @@
+import argparse
+
+import teuthology.suite
+
+
+def main():
+    teuthology.suite.main(parse_args())
+
+
+def parse_args():
+    parser = argparse.ArgumentParser(description="""
+Run a suite of ceph integration tests.
+
+A suite is a set of collections.
+
+A collection is a directory containing facets.
+
+A facet is a directory containing config snippets.
+
+Running a collection means running teuthology for every configuration
+combination generated by taking one config snippet from each facet.
+
+Any config files passed on the command line will be used for every
+combination, and will override anything in the suite.
+""")
+    parser.add_argument(
+        '-v', '--verbose',
+        action='store_true', default=None,
+        help='be more verbose',
+    )
+    parser.add_argument(
+        '--dry-run',
+        action='store_true', default=None,
+        help='do a dry run; do not schedule anything',
+    )
+    parser.add_argument(
+        '--name',
+        help='name for this suite',
+        required=True,
+    )
+    parser.add_argument(
+        '--base',
+        default=None,
+        help='base directory for the collection(s)'
+    )
+    parser.add_argument(
+        '--collections',
+        metavar='DIR',
+        nargs='+',
+        required=True,
+        help='the collections to run',
+    )
+    parser.add_argument(
+        '--owner',
+        help='job owner',
+    )
+    parser.add_argument(
+        '--email',
+        help='address to email test failures to',
+    )
+    parser.add_argument(
+        '--timeout',
+        help='how many seconds to wait for jobs to finish before emailing ' +
+        'results',
+    )
+    parser.add_argument(
+        '-n', '--num',
+        default=1,
+        type=int,
+        help='number of times to run/queue each job'
+    )
+    parser.add_argument(
+        '-w', '--worker',
+        default='plana',
+        help='which worker to use (type of machine)',
+    )
+    parser.add_argument(
+        'config',
+        metavar='CONFFILE',
+        nargs='*',
+        default=[],
+        help='config file to read',
+    )
+
+    return parser.parse_args()
index e5bde8e8c2e61febde9d20351dc94f6528e202eb..d3df1c6acbe244d1e58e5810a0c457681a06fd73 100644 (file)
--- a/setup.py
+++ b/setup.py
@@ -18,7 +18,7 @@ setup(
         'console_scripts': [
             'teuthology = teuthology.run:main',
             'teuthology-nuke = scripts.nuke:main',
-            'teuthology-suite = teuthology.suite:main',
+            'teuthology-suite = scripts.suite:main',
             'teuthology-ls = teuthology.suite:ls',
             'teuthology-worker = teuthology.queue:worker',
             'teuthology-lock = teuthology.lock:main',
index 507bf0741e053f7df19f9a8ae073a4f6f8a7ae34..42cc2e37fbdfa9ad7371e118f25404a81d50e551 100644 (file)
@@ -21,82 +21,7 @@ from teuthology import lock as lock
 log = logging.getLogger(__name__)
 
 
-def main():
-    parser = argparse.ArgumentParser(description="""
-Run a suite of ceph integration tests.
-
-A suite is a set of collections.
-
-A collection is a directory containing facets.
-
-A facet is a directory containing config snippets.
-
-Running a collection means running teuthology for every configuration
-combination generated by taking one config snippet from each facet.
-
-Any config files passed on the command line will be used for every
-combination, and will override anything in the suite.
-""")
-    parser.add_argument(
-        '-v', '--verbose',
-        action='store_true', default=None,
-        help='be more verbose',
-        )
-    parser.add_argument(
-        '--dry-run',
-        action='store_true', default=None,
-        help='do a dry run; do not schedule anything',
-        )
-    parser.add_argument(
-        '--name',
-        help='name for this suite',
-        required=True,
-        )
-    parser.add_argument(
-        '--base',
-        default=None,
-        help='base directory for the collection(s)'
-        )
-    parser.add_argument(
-        '--collections',
-        metavar='DIR',
-        nargs='+',
-        required=True,
-        help='the collections to run',
-        )
-    parser.add_argument(
-        '--owner',
-        help='job owner',
-        )
-    parser.add_argument(
-        '--email',
-        help='address to email test failures to',
-        )
-    parser.add_argument(
-        '--timeout',
-        help='how many seconds to wait for jobs to finish before emailing results',
-        )
-    parser.add_argument(
-        '-n', '--num',
-        default=1,
-        type=int,
-        help='number of times to run/queue each job'
-        )
-    parser.add_argument(
-        '-w', '--worker',
-        default='plana',
-        help='which worker to use (type of machine)',
-        )
-    parser.add_argument(
-        'config',
-        metavar='CONFFILE',
-        nargs='*',
-        default=[],
-        help='config file to read',
-        )
-
-    args = parser.parse_args()
-
+def main(args):
     loglevel = logging.INFO
     if args.verbose:
         loglevel = logging.DEBUG