Пример #1
0
 def test_list_type_with_is_available_exception(self):
     registry = resources.global_env().registry
     self.patchobject(
         generic_resource.GenericResource,
         'is_service_available',
         side_effect=exception.ClientNotAvailable(client_name='generic'))
     types = registry.get_types(utils.dummy_context())
     self.assertNotIn('GenericResourceType', types)
Пример #2
0
def get_files_from_container(cnxt, files_container, files=None):

    if files is None:
        files = {}
    else:
        files = files.copy()

    swift_plugin = cnxt.clients.client_plugin('swift')

    if not swift_plugin:
        raise exception.ClientNotAvailable(client_name='swift')

    new_files = swift_plugin.get_files_from_container(files_container,
                                                      list(files.keys()))
    new_files.update(files)
    return new_files