✨ add functionality to os_migrate_teardown.py
This commit is contained in:
parent
e62f806e86
commit
0f33e5612a
1 changed files with 32 additions and 15 deletions
|
|
@ -122,30 +122,47 @@ def destroy_private_network(args):
|
|||
print("deleting private network")
|
||||
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):
|
||||
"""Coming soon - create the cirros flavor"""
|
||||
# pylint: disable=unused-argument
|
||||
print("creating cirros flavor - NYI")
|
||||
|
||||
"""Delete the cirros flavor"""
|
||||
delete_flavor(args, "cirros")
|
||||
|
||||
def destroy_rhel_flavor(args):
|
||||
"""Coming soon - create the rhel flavor"""
|
||||
# pylint: disable=unused-argument
|
||||
print("creating rhel flavor - NYI")
|
||||
"""Delete the rhel flavor"""
|
||||
delete_flavor(args, "rhel")
|
||||
|
||||
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):
|
||||
"""Coming soon - destroy the cirros image"""
|
||||
# pylint: disable=unused-argument
|
||||
print("destroying cirros image - NYI")
|
||||
|
||||
"""Delete the cirros image"""
|
||||
delete_image(args, "cirros")
|
||||
|
||||
def destroy_rhel_image(args):
|
||||
"""Coming soon - create the rhel image"""
|
||||
# pylint: disable=unused-argument
|
||||
print("creating rhel image - NYI")
|
||||
|
||||
"""Delete the rhel image"""
|
||||
delete_image(args, "rhel")
|
||||
|
||||
def destroy_cirros_instance(args):
|
||||
"""Delete the cirros instance"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue