本文整理汇总了Python中tempest.lib.common.utils.test_utils.call_and_ignore_notfound_exc函数的典型用法代码示例。如果您正苦于以下问题:Python call_and_ignore_notfound_exc函数的具体用法?Python call_and_ignore_notfound_exc怎么用?Python call_and_ignore_notfound_exc使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了call_and_ignore_notfound_exc函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: delete_containers
def delete_containers(cls, container_client=None,
object_client=None):
"""Remove containers and all objects in them.
The containers should be visible from the container_client given.
Will not throw any error if the containers don't exist.
Will not check that object and container deletions succeed.
:param container_client: if None, use cls.container_client, this means
that the default testing user will be used (see 'username' in
'etc/tempest.conf')
:param object_client: if None, use cls.object_client
"""
if container_client is None:
container_client = cls.container_client
if object_client is None:
object_client = cls.object_client
for cont in cls.containers:
try:
params = {'limit': 9999, 'format': 'json'}
resp, objlist = container_client.list_container_contents(
cont, params)
# delete every object in the container
for obj in objlist:
test_utils.call_and_ignore_notfound_exc(
object_client.delete_object, cont, obj['name'])
container_client.delete_container(cont)
except lib_exc.NotFound:
pass
示例2: resource_cleanup
def resource_cleanup(cls):
for lb_id in cls._lbs_to_delete:
try:
lb = cls.load_balancers_client.get_load_balancer_status_tree(
lb_id).get('loadbalancer')
except exceptions.NotFound:
continue
for listener in lb.get('listeners'):
for pool in listener.get('pools'):
hm = pool.get('healthmonitor')
if hm:
test_utils.call_and_ignore_notfound_exc(
cls.health_monitors_client.delete_health_monitor,
pool.get('healthmonitor').get('id'))
cls._wait_for_load_balancer_status(lb_id)
test_utils.call_and_ignore_notfound_exc(
cls.pools_client.delete_pool,
pool.get('id'))
cls._wait_for_load_balancer_status(lb_id)
health_monitor = pool.get('healthmonitor')
if health_monitor:
test_utils.call_and_ignore_notfound_exc(
cls.health_monitors_client.delete_health_monitor,
health_monitor.get('id'))
cls._wait_for_load_balancer_status(lb_id)
test_utils.call_and_ignore_notfound_exc(
cls.listeners_client.delete_listener,
listener.get('id'))
cls._wait_for_load_balancer_status(lb_id)
test_utils.call_and_ignore_notfound_exc(
cls._delete_load_balancer, lb_id)
super(BaseTestCase, cls).resource_cleanup()
示例3: clear_volume_type
def clear_volume_type(cls, vol_type_id):
test_utils.call_and_ignore_notfound_exc(
cls.admin_volume_types_client.delete_volume_type, vol_type_id)
test_utils.call_and_ignore_notfound_exc(
cls.admin_volume_types_client.wait_for_resource_deletion,
vol_type_id)
示例4: tearDown
def tearDown(self):
try:
test_utils.call_and_ignore_notfound_exc(
self.client.delete_agent, self.agent_id)
except Exception:
LOG.exception('Exception raised deleting agent %s', self.agent_id)
super(AgentsAdminTestJSON, self).tearDown()
示例5: tearDown
def tearDown(self):
for obj in self.objects:
test_utils.call_and_ignore_notfound_exc(
self.object_client.delete_object,
self.container_name, obj)
self.container_client.delete_container(self.container_name)
super(ObjectSloTest, self).tearDown()
示例6: delete_containers
def delete_containers(containers, container_client, object_client):
"""Remove containers and all objects in them.
The containers should be visible from the container_client given.
Will not throw any error if the containers don't exist.
Will not check that object and container deletions succeed.
After delete all the objects from a container, it will wait 2
seconds before delete the container itself, in order to deployments
using HA proxy sync the deletion properly, otherwise, the container
might fail to be deleted because it's not empty.
:param containers: List of containers to be deleted
:param container_client: Client to be used to delete containers
:param object_client: Client to be used to delete objects
"""
for cont in containers:
try:
params = {'limit': 9999, 'format': 'json'}
_, objlist = container_client.list_container_objects(cont, params)
# delete every object in the container
for obj in objlist:
test_utils.call_and_ignore_notfound_exc(
object_client.delete_object, cont, obj['name'])
# sleep 2 seconds to sync the deletion of the objects
# in HA deployment
time.sleep(2)
container_client.delete_container(cont)
except lib_exc.NotFound:
pass
示例7: clear_images
def clear_images(cls):
LOG.debug('Clearing images: %s', ','.join(cls.images))
for image_id in cls.images:
try:
test_utils.call_and_ignore_notfound_exc(
cls.compute_images_client.delete_image, image_id)
except Exception:
LOG.exception('Exception raised deleting image %s' % image_id)
示例8: resource_cleanup
def resource_cleanup(cls):
for image_id in cls.created_images:
test_utils.call_and_ignore_notfound_exc(
cls.client.delete_image, image_id)
for image_id in cls.created_images:
cls.client.wait_for_resource_deletion(image_id)
super(BaseImageTest, cls).resource_cleanup()
示例9: delete_router
def delete_router(cls, router):
body = cls.ports_client.list_ports(device_id=router["id"])
interfaces = body["ports"]
for i in interfaces:
test_utils.call_and_ignore_notfound_exc(
cls.routers_client.remove_router_interface, router["id"], subnet_id=i["fixed_ips"][0]["subnet_id"]
)
cls.routers_client.delete_router(router["id"])
示例10: delete_router
def delete_router(cls, router):
body = cls.ports_client.list_ports(device_id=router['id'])
interfaces = body['ports']
for i in interfaces:
test_utils.call_and_ignore_notfound_exc(
cls.routers_client.remove_router_interface, router['id'],
subnet_id=i['fixed_ips'][0]['subnet_id'])
cls.routers_client.delete_router(router['id'])
示例11: trunks_cleanup
def trunks_cleanup(client, trunks):
for trunk in trunks:
subports = test_utils.call_and_ignore_notfound_exc(
client.get_subports, trunk['id'])
if subports:
client.remove_subports(
trunk['id'], subports['sub_ports'])
test_utils.call_and_ignore_notfound_exc(
client.delete_trunk, trunk['id'])
示例12: _clear_stacks
def _clear_stacks(cls):
for stack_identifier in cls.stacks:
test_utils.call_and_ignore_notfound_exc(
cls.client.delete_stack, stack_identifier)
for stack_identifier in cls.stacks:
test_utils.call_and_ignore_notfound_exc(
cls.client.wait_for_stack_status, stack_identifier,
'DELETE_COMPLETE')
示例13: resource_cleanup
def resource_cleanup(cls):
test_utils.call_and_ignore_notfound_exc(
cls._delete_load_balancer,
cls.load_balancer['id'])
cls._wait_for_load_balancer_status(
load_balancer_id=cls.load_balancer['id'], delete=True)
test_utils.call_and_ignore_notfound_exc(
cls._delete_load_balancer,
cls.tenant_load_balancer['id'])
cls._wait_for_load_balancer_status(
load_balancer_id=cls.tenant_load_balancer['id'], delete=True)
示例14: clear_server_groups
def clear_server_groups(cls):
LOG.debug('Clearing server groups: %s', ','.join(cls.server_groups))
for server_group_id in cls.server_groups:
try:
test_utils.call_and_ignore_notfound_exc(
cls.server_groups_client.delete_server_group,
server_group_id
)
except Exception:
LOG.exception('Exception raised deleting server-group %s',
server_group_id)
示例15: clear_security_groups
def clear_security_groups(cls):
LOG.debug('Clearing security groups: %s', ','.join(
str(sg['id']) for sg in cls.security_groups))
for sg in cls.security_groups:
try:
test_utils.call_and_ignore_notfound_exc(
cls.security_groups_client.delete_security_group, sg['id'])
except Exception as exc:
LOG.info('Exception raised deleting security group %s',
sg['id'])
LOG.exception(exc)