Example #1
0
 def test__clean_up_boot_iso_for_instance(self, swift_mock, boot_object_name_mock):
     swift_obj_mock = swift_mock.return_value
     CONF.ilo.swift_ilo_container = "ilo-cont"
     boot_object_name_mock.return_value = "boot-object"
     i_info = self.node.instance_info
     i_info["ilo_boot_iso"] = "swift:bootiso"
     self.node.instance_info = i_info
     self.node.save()
     ilo_boot._clean_up_boot_iso_for_instance(self.node)
     swift_obj_mock.delete_object.assert_called_once_with("ilo-cont", "boot-object")
Example #2
0
    def test__clean_up_boot_iso_for_instance_on_webserver(self, unlink_mock):

        CONF.ilo.use_web_server_for_images = True
        CONF.deploy.http_root = "/webserver"
        i_info = self.node.instance_info
        i_info['ilo_boot_iso'] = 'http://x.y.z.a/webserver/boot-object'
        self.node.instance_info = i_info
        self.node.save()
        boot_iso_path = "/webserver/boot-object"
        ilo_boot._clean_up_boot_iso_for_instance(self.node)
        unlink_mock.assert_called_once_with(boot_iso_path)
Example #3
0
    def test__clean_up_boot_iso_for_instance_on_webserver(self, unlink_mock):

        CONF.ilo.use_web_server_for_images = True
        CONF.deploy.http_root = "/webserver"
        i_info = self.node.instance_info
        i_info['ilo_boot_iso'] = 'http://x.y.z.a/webserver/boot-object'
        self.node.instance_info = i_info
        self.node.save()
        boot_iso_path = "/webserver/boot-object"
        ilo_boot._clean_up_boot_iso_for_instance(self.node)
        unlink_mock.assert_called_once_with(boot_iso_path)
Example #4
0
 def test__clean_up_boot_iso_for_instance(self, swift_mock,
                                          boot_object_name_mock):
     swift_obj_mock = swift_mock.return_value
     CONF.ilo.swift_ilo_container = 'ilo-cont'
     boot_object_name_mock.return_value = 'boot-object'
     i_info = self.node.instance_info
     i_info['ilo_boot_iso'] = 'swift:bootiso'
     self.node.instance_info = i_info
     self.node.save()
     ilo_boot._clean_up_boot_iso_for_instance(self.node)
     swift_obj_mock.delete_object.assert_called_once_with('ilo-cont',
                                                          'boot-object')
Example #5
0
 def test__clean_up_boot_iso_for_instance(self, swift_mock,
                                          boot_object_name_mock):
     swift_obj_mock = swift_mock.return_value
     CONF.ilo.swift_ilo_container = 'ilo-cont'
     boot_object_name_mock.return_value = 'boot-object'
     i_info = self.node.instance_info
     i_info['ilo_boot_iso'] = 'swift:bootiso'
     self.node.instance_info = i_info
     self.node.save()
     ilo_boot._clean_up_boot_iso_for_instance(self.node)
     swift_obj_mock.delete_object.assert_called_once_with('ilo-cont',
                                                          'boot-object')
Example #6
0
 def test__clean_up_boot_iso_for_instance_exc(self, swift_mock, boot_object_name_mock, log_mock):
     swift_obj_mock = swift_mock.return_value
     exc = exception.SwiftObjectNotFoundError("error")
     swift_obj_mock.delete_object.side_effect = exc
     CONF.ilo.swift_ilo_container = "ilo-cont"
     boot_object_name_mock.return_value = "boot-object"
     i_info = self.node.instance_info
     i_info["ilo_boot_iso"] = "swift:bootiso"
     self.node.instance_info = i_info
     self.node.save()
     ilo_boot._clean_up_boot_iso_for_instance(self.node)
     swift_obj_mock.delete_object.assert_called_once_with("ilo-cont", "boot-object")
     self.assertTrue(log_mock.called)
Example #7
0
 def test__clean_up_boot_iso_for_instance_exc(self, swift_mock,
                                              boot_object_name_mock,
                                              log_mock):
     swift_obj_mock = swift_mock.return_value
     exc = exception.SwiftObjectNotFoundError('error')
     swift_obj_mock.delete_object.side_effect = exc
     CONF.ilo.swift_ilo_container = 'ilo-cont'
     boot_object_name_mock.return_value = 'boot-object'
     i_info = self.node.instance_info
     i_info['ilo_boot_iso'] = 'swift:bootiso'
     self.node.instance_info = i_info
     self.node.save()
     ilo_boot._clean_up_boot_iso_for_instance(self.node)
     swift_obj_mock.delete_object.assert_called_once_with('ilo-cont',
                                                          'boot-object')
     self.assertTrue(log_mock.called)
Example #8
0
 def test__clean_up_boot_iso_for_instance_exc(self, swift_mock,
                                              boot_object_name_mock,
                                              log_mock):
     swift_obj_mock = swift_mock.return_value
     exc = exception.SwiftObjectNotFoundError('error')
     swift_obj_mock.delete_object.side_effect = exc
     CONF.ilo.swift_ilo_container = 'ilo-cont'
     boot_object_name_mock.return_value = 'boot-object'
     i_info = self.node.instance_info
     i_info['ilo_boot_iso'] = 'swift:bootiso'
     self.node.instance_info = i_info
     self.node.save()
     ilo_boot._clean_up_boot_iso_for_instance(self.node)
     swift_obj_mock.delete_object.assert_called_once_with('ilo-cont',
                                                          'boot-object')
     self.assertTrue(log_mock.called)
Example #9
0
 def test__clean_up_boot_iso_for_instance_no_boot_iso(
         self, boot_object_name_mock):
     ilo_boot._clean_up_boot_iso_for_instance(self.node)
     self.assertFalse(boot_object_name_mock.called)
Example #10
0
 def test__clean_up_boot_iso_for_instance_no_boot_iso(
         self, boot_object_name_mock):
     ilo_boot._clean_up_boot_iso_for_instance(self.node)
     self.assertFalse(boot_object_name_mock.called)