Esempio n. 1
0
 def test_heat_update_stack_env_err(self):
     '''
     Test salt.modules.heat.update_method method
     with environment set and there is an error
     reading the environment file
     '''
     patch_file = patch.dict(
         heat.__salt__, {
             'file.get_managed':
             file_.get_managed,
             'file.manage_file':
             MagicMock(side_effect=[{
                 'result': True
             }, {
                 'result': False
             }]),
         })
     with patch_file, self.patch_check:
         ret = heat.update_stack(
             name='mystack',
             profile='openstack1',
             template_file=os.path.join(RUNTIME_VARS.BASE_FILES,
                                        'templates', 'heat-template.yml'),
             environment=os.path.join(RUNTIME_VARS.BASE_FILES, 'templates',
                                      'heat-env.yml'))
     assert ret == {
         'result': False,
         'comment':
         'Error parsing template Template format version not found.'
     }
Esempio n. 2
0
 def test_heat_update_stack_env_err(self):
     """
     Test salt.modules.heat.update_method method
     with environment set and there is an error
     reading the environment file
     """
     patch_file = patch.dict(
         heat.__salt__,
         {
             "file.get_managed": file_.get_managed,
             "file.manage_file": MagicMock(
                 side_effect=[{"result": True}, {"result": False}]
             ),
         },
     )
     with patch_file, self.patch_check:
         ret = heat.update_stack(
             name="mystack",
             profile="openstack1",
             template_file=os.path.join(
                 RUNTIME_VARS.BASE_FILES, "templates", "heat-template.yml"
             ),
             environment=os.path.join(
                 RUNTIME_VARS.BASE_FILES, "templates", "heat-env.yml"
             ),
         )
     assert ret == {
         "result": False,
         "comment": "Error parsing template Template format version not found.",
     }
Esempio n. 3
0
 def test_heat_update_stack_env(self):
     """
     Test salt.modules.heat.update_method method
     with environment set
     """
     patch_file = patch.dict(
         heat.__salt__,
         {
             "file.get_managed": file_.get_managed,
             "file.manage_file": file_.manage_file,
         },
     )
     with patch_file, self.patch_check:
         ret = heat.update_stack(
             name="mystack",
             profile="openstack1",
             template_file=os.path.join(RUNTIME_VARS.BASE_FILES,
                                        "templates", "heat-template.yml"),
             environment=os.path.join(RUNTIME_VARS.BASE_FILES, "templates",
                                      "heat-env.yml"),
         )
     assert ret == {
         "result": True,
         "comment": ("Updated stack 'mystack'.", )
     }
Esempio n. 4
0
 def test_heat_update_stack(self):
     '''
     Test salt.modules.heat.update_method method
     '''
     patch_file = patch.dict(
         heat.__salt__,
         {
             'file.get_managed': file_.get_managed,
             'file.manage_file': file_.manage_file,
         },
     )
     with patch_file, self.patch_check:
         ret = heat.update_stack(name='mystack',
                                 profile='openstack1',
                                 template_file=os.path.join(
                                     RUNTIME_VARS.BASE_FILES, 'templates',
                                     'heat-template.yml'))
     assert ret == {
         'result': True,
         'comment': ("Updated stack 'mystack'.", )
     }