Merge "Revert "Adding in support for Lithium container." since it doesnt deploy"
[genesis.git] / fuel / deploy / deploy.py
index 3305aed..33c6f9f 100644 (file)
@@ -2,6 +2,7 @@ import os
 import shutil
 import io
 import re
+import sys
 import netaddr
 import uuid
 import yaml
@@ -138,7 +139,7 @@ class AutoDeploy(object):
     def deploy_env(self):
         dep = CloudDeploy(self.dha, self.fuel_conf['ip'], self.fuel_username,
                           self.fuel_password, self.dea_file, WORK_DIR)
-        dep.deploy()
+        return dep.deploy()
 
     def setup_execution_environment(self):
         exec_env = ExecutionEnvironment(self.storage_dir, self.pxe_bridge,
@@ -157,7 +158,7 @@ class AutoDeploy(object):
             self.create_tmp_dir()
             self.install_fuel_master()
             shutil.rmtree(self.tmp_dir)
-        self.deploy_env()
+        return self.deploy_env()
 
 def check_bridge(pxe_bridge, dha_path):
     with io.open(dha_path) as yaml_file:
@@ -183,15 +184,16 @@ def parse_arguments():
                         help='Deployment Environment Adapter: dea.yaml')
     parser.add_argument('dha_file', action='store',
                         help='Deployment Hardware Adapter: dha.yaml')
-    parser.add_argument('storage_dir', nargs='?', action='store',
+    parser.add_argument('-s', dest='storage_dir', action='store',
                         default='%s/images' % CWD,
                         help='Storage Directory [default: images]')
-    parser.add_argument('pxe_bridge', nargs='?', action='store',
+    parser.add_argument('-b', dest='pxe_bridge', action='store',
                         default='pxebr',
                         help='Linux Bridge for booting up the Fuel Master VM '
                              '[default: pxebr]')
 
     args = parser.parse_args()
+    log(args)
 
     check_file_exists(args.dea_file)
     check_file_exists(args.dha_file)
@@ -201,8 +203,6 @@ def parse_arguments():
         check_file_exists(args.iso_file)
         log('Using image directory: %s' % args.storage_dir)
         create_dir_if_not_exists(args.storage_dir)
-        log('Using bridge %s to boot up Fuel Master VM on it'
-            % args.pxe_bridge)
         check_bridge(args.pxe_bridge, args.dha_file)
 
     return (args.without_fuel, args.storage_dir, args.pxe_bridge,
@@ -215,7 +215,7 @@ def main():
 
     d = AutoDeploy(without_fuel, storage_dir, pxe_bridge, iso_file,
                    dea_file, dha_file)
-    d.deploy()
+    sys.exit(d.deploy())
 
 if __name__ == '__main__':
     main()
\ No newline at end of file