commit 3fbbd85d3a6a5572b0f8c0944ed5922734b8e329
Author: Christos Stavrakakis <cstavr@grnet.gr>
Date:   Tue Jul 30 17:14:11 2013 +0300

    ci: Helper script to run ci commands
    
    Make 'snf-ci' python script to run CI commands.

diff --git a/ci/autopkg_debian.py b/ci/autopkg_debian.py
deleted file mode 100755
index dcaa655..0000000
--- a/ci/autopkg_debian.py
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/usr/bin/env python
-
-"""
-Build Synnefo packages for debian
-"""
-
-from utils import SynnefoCI
-
-
-def autopkg_debian():
-    """Build synnefo packages for debian"""
-    synnefo_ci = SynnefoCI()
-    synnefo_ci.build_synnefo()
-
-
-if __name__ == "__main__":
-    autopkg_debian()
diff --git a/ci/deploy.py b/ci/deploy.py
deleted file mode 100755
index 82eef3f..0000000
--- a/ci/deploy.py
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/usr/bin/env python
-
-"""
-Deploy Synnefo using snf-deploy
-"""
-
-from utils import SynnefoCI
-
-
-def deploy_synnefo():
-    """Deploy Synnefo using snf-deploy"""
-    synnefo_ci = SynnefoCI()
-    synnefo_ci.deploy_synnefo()
-
-
-if __name__ == "__main__":
-    deploy_synnefo()
diff --git a/ci/run_burnin.py b/ci/run_burnin.py
deleted file mode 100755
index 3458438..0000000
--- a/ci/run_burnin.py
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/usr/bin/env python
-
-"""
-Run burnin functional test suite
-"""
-
-from utils import SynnefoCI
-
-
-def run_burnin():
-    """Run burnin functional test suite"""
-    synnefo_ci = SynnefoCI()
-    synnefo_ci.run_burnin()
-
-
-if __name__ == "__main__":
-    run_burnin()
diff --git a/ci/setup_slave.py b/ci/setup_slave.py
deleted file mode 100755
index 29608af..0000000
--- a/ci/setup_slave.py
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/usr/bin/env python
-
-"""
-Setup slave server
-"""
-
-from utils import SynnefoCI
-
-
-def setup_slave():
-    """Setup slave server"""
-    synnefo_ci = SynnefoCI(cleanup_config=True)
-    # Build slave server
-    synnefo_ci.create_server()
-    # Copy synnefo repo to server
-    synnefo_ci.clone_repo()
-
-
-if __name__ == "__main__":
-    setup_slave()
diff --git a/ci/snf-ci b/ci/snf-ci
new file mode 100755
index 0000000..b61bfad
--- /dev/null
+++ b/ci/snf-ci
@@ -0,0 +1,93 @@
+#!/usr/bin/env python
+
+"""
+"""
+from utils import SynnefoCI
+from optparse import OptionParser
+
+CREATE_SERVER_CMD = "create"
+BUILD_SYNNEFO_CMD = "build"
+DEPLOY_SYNNEFO_CMD = "deploy"
+TEST_SYNNEFO_CMD = "test"
+RUN_BURNIN_CMD = "burnin"
+ALL_CMDS = "all"
+
+AVAILABLE_COMMANDS = [
+    CREATE_SERVER_CMD,
+    BUILD_SYNNEFO_CMD,
+    DEPLOY_SYNNEFO_CMD,
+    TEST_SYNNEFO_CMD,
+    RUN_BURNIN_CMD,
+]
+
+CLEAN_CONFIG_CMDS = [CREATE_SERVER_CMD, ALL_CMDS]
+
+USAGE = """usage: %%prog [options] command
+
+command:
+    * %s Create the slave server
+    * %s: Create in Synnefo packages in created server
+    * %s: Deploy Synnefo in created server
+    * %s: Run Synnefo unittests
+    * %s: Run snf-burnin in the deployed Synnefo
+
+    * %s: Run all the available commands
+""" % tuple([CREATE_SERVER_CMD,
+             BUILD_SYNNEFO_CMD,
+             DEPLOY_SYNNEFO_CMD,
+             TEST_SYNNEFO_CMD,
+             RUN_BURNIN_CMD,
+             ALL_CMDS])
+
+
+def main():
+    parser = OptionParser(usage=USAGE)
+    parser.add_option("-c", "--cloud", dest="kamaki_cloud", default=None,
+                      help="Use specified cloud, as is in .kamakirc"),
+    parser.add_option("-f", "--flavor", dest="flavor", default=None,
+                      help="Name of flavor to use for the server.")
+    parser.add_option("-i", "--image", dest="image", default=None,
+                      help="UUID of image to use for the server.")
+
+    (options, args) = parser.parse_args()
+
+    if len(args) != 1:
+        msg = "ERROR: Command takes exactly one argument"
+        parser.print_help()
+        print
+        print msg
+        return
+
+    command = args[0]
+    if command == ALL_CMDS:
+        for cmd in AVAILABLE_COMMANDS:
+            setattr(options, cmd, True)
+    elif command not in AVAILABLE_COMMANDS:
+        msg = "ERROR: Unknown command: %s" % command
+        parser.print_help()
+        print
+        print msg
+        return
+    else:
+        setattr(options, command, True)
+
+    cleanup_config = command in CLEAN_CONFIG_CMDS
+    synnefo_ci = SynnefoCI(cleanup_config=cleanup_config,
+                           cloud=options.kamaki_cloud)
+
+    if getattr(options, CREATE_SERVER_CMD, False):
+        synnefo_ci.create_server(flavor_id=options.flavor,
+                                 image_id=options.image)
+        synnefo_ci.clone_repo()
+    if getattr(options, BUILD_SYNNEFO_CMD, False):
+        synnefo_ci.build_synnefo()
+    if getattr(options, DEPLOY_SYNNEFO_CMD, False):
+        synnefo_ci.deploy_synnefo()
+    if getattr(options, TEST_SYNNEFO_CMD, False):
+        synnefo_ci.unit_test()
+    if getattr(options, RUN_BURNIN_CMD, False):
+        synnefo_ci.run_burnin()
+
+
+if __name__ == "__main__":
+    main()
diff --git a/ci/unit_tests.py b/ci/unit_tests.py
deleted file mode 100755
index 3cfc2f4..0000000
--- a/ci/unit_tests.py
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/usr/bin/env python
-
-"""
-Run Synnefo unit test suite
-"""
-
-from utils import SynnefoCI
-
-
-def unit_test():
-    """Run Synnefo unit test suite"""
-    synnefo_ci = SynnefoCI()
-    synnefo_ci.unit_test()
-
-
-if __name__ == "__main__":
-    unit_test()
