Project Cleanup

This commit is contained in:
Cory Hawkless 2022-11-14 12:22:32 +10:30
parent 2a7cc03d58
commit 55104a5538
5 changed files with 8 additions and 4 deletions

View File

@ -7,6 +7,7 @@ import myOpenstackApp
testProjectName="SmokeTest" testProjectName="SmokeTest"
testProjectExists=False testProjectExists=False
testProject="" testProject=""
cleanupResourcesOnCompletion=True
y=myOpenstackApp.OSC y=myOpenstackApp.OSC
y.initalise() y.initalise()
@ -41,8 +42,8 @@ else:
def cleanUp(): def cleanUp():
log.info["Cleaning up"] log.info("Cleaning up")
log.info["Deleting project"] log.info("Deleting project")
y.ks.deleteProject(testProject['id']) y.ks.deleteProject(testProject['id'])
#Delete VM #Delete VM
#Delete router #Delete router
@ -51,4 +52,5 @@ def cleanUp():
pass pass
cleanUp() if cleanupResourcesOnCompletion:
cleanUp()

View File

@ -67,6 +67,8 @@ class OpenStackConnection_x:
response = requests.get(url, headers=headers) response = requests.get(url, headers=headers)
elif getPost=="POST": elif getPost=="POST":
response = requests.post(url, data=data_json, headers=headers) response = requests.post(url, data=data_json, headers=headers)
elif getPost=="DELETE":
response = requests.delete(url, headers=headers)
else: else:
raise ValueError("Unknown request type") raise ValueError("Unknown request type")

View File

@ -82,5 +82,5 @@ class myopenstack_keystone():
log.info("Deleting a project") log.info("Deleting a project")
_self.newProjectData=_self.connection.make_request("DELETE", "projects/"+id, "", _self.newProjectData=_self.connection.make_request("DELETE", "projects/"+id, "",
os.getenv("OS_AUTH_URL")).json() os.getenv("OS_AUTH_URL"))
return _self.newProjectData return _self.newProjectData