Merge "Add high_availability test case"
authorjulien zhang <zhang.jun3g@zte.com.cn>
Mon, 22 Aug 2016 13:52:23 +0000 (13:52 +0000)
committerGerrit Code Review <gerrit@172.30.200.206>
Mon, 22 Aug 2016 13:52:23 +0000 (13:52 +0000)
tosca2heat/heat-translator/translator/shell.py
tosca2heat/heat-translator/translator/tests/test_shell.py

index 884e3a6..dc49b5c 100644 (file)
@@ -129,7 +129,10 @@ class TranslatorShell(object):
                 if heat_tpl:
                     if utils.check_for_env_variables() and deploy:
                         try:
-                            heatclient(heat_tpl, stack_name, parsed_params)
+                            file_name = os.path.basename(
+                                os.path.splitext(template_file)[0])
+                            heatclient(heat_tpl, stack_name,
+                                       file_name, parsed_params)
                         except Exception:
                             log.error(_("Unable to launch the heat stack"))
 
@@ -184,7 +187,7 @@ class TranslatorShell(object):
                 print(output)
 
 
-def heatclient(output, stack_name, params):
+def heatclient(output, stack_name, file_name, params):
     try:
         access_dict = utils.get_ks_access_dict()
         endpoint = utils.get_url_for(access_dict, 'orchestration')
@@ -197,7 +200,7 @@ def heatclient(output, stack_name, params):
     }
 
     heat_stack_name = stack_name if stack_name else \
-        "heat_" + str(uuid.uuid4()).split("-")[0]
+        "heat_" + file_name + '_' + str(uuid.uuid4()).split("-")[0]
     output = yaml.load(output)
     output['heat_template_version'] = str(output['heat_template_version'])
     data = {
index 62f3510..5d41921 100644 (file)
@@ -137,7 +137,7 @@ class ShellTest(TestCase):
                                       'demo', 'http://www.abc.com']
         try:
             data = {
-                'stack_name': 'heat_abcXXX',
+                'stack_name': 'heat_tosca_helloworld_abcXXX',
                 'parameters': {},
                 'template': {
                     'outputs': {},