add functionality to os_migrate_teardown.py

This commit is contained in:
Neill Cox 2023-10-21 10:40:41 +11:00
parent e62f806e86
commit 0f33e5612a

View file

@ -122,30 +122,47 @@ def destroy_private_network(args):
print("deleting private network") print("deleting private network")
test_user_openstack_cmd("network delete private", args) test_user_openstack_cmd("network delete private", args)
def delete_flavor(args,name):
flavor_exists = [
flavor
for flavor in openstack_cmd(
"flavor list -f json", args, as_json=True
)
if flavor["Name"] == "cirros"
]
if flavor_exists:
print(f"deleting {name} flavor")
test_user_openstack_cmd("flavor delete f{name}", args)
def destroy_cirros_flavor(args): def destroy_cirros_flavor(args):
"""Coming soon - create the cirros flavor""" """Delete the cirros flavor"""
# pylint: disable=unused-argument delete_flavor(args, "cirros")
print("creating cirros flavor - NYI")
def destroy_rhel_flavor(args): def destroy_rhel_flavor(args):
"""Coming soon - create the rhel flavor""" """Delete the rhel flavor"""
# pylint: disable=unused-argument delete_flavor(args, "rhel")
print("creating rhel flavor - NYI")
def delete_image(args, name):
image_exists = [
image
for image in openstack_cmd(
"image list -f json", args, as_json=True
)
if image["Name"] == "cirros"
]
if image_exists:
print(f"deleting {name} image")
test_user_openstack_cmd("image delete f{name}", args)
def destroy_cirros_image(args): def destroy_cirros_image(args):
"""Coming soon - destroy the cirros image""" """Delete the cirros image"""
# pylint: disable=unused-argument delete_image(args, "cirros")
print("destroying cirros image - NYI")
def destroy_rhel_image(args): def destroy_rhel_image(args):
"""Coming soon - create the rhel image""" """Delete the rhel image"""
# pylint: disable=unused-argument delete_image(args, "rhel")
print("creating rhel image - NYI")
def destroy_cirros_instance(args): def destroy_cirros_instance(args):
"""Delete the cirros instance""" """Delete the cirros instance"""