Searching projectS
This commit is contained in:
parent
3b4e13697d
commit
48b9345fc0
11
main.py
11
main.py
|
@ -18,3 +18,14 @@ x.keystone.getCatalog()
|
|||
# neutronURL=x.keystone.getEndpointByNameIDAndInterface("NeuTrOn","internal")['url']
|
||||
# print(neutronURL)
|
||||
projects=x.keystone.getAllProjects()
|
||||
print(projects)
|
||||
testProjectName="SmokeTest"
|
||||
|
||||
#Does my test project ID already exist?
|
||||
if testProjectName in projects['projects']:
|
||||
log.error("Project already exists")
|
||||
log.error(projects['projects'][testProjectName])
|
||||
else:
|
||||
log.info("{} project does not exist, creating".format(testProjectName))
|
||||
x.keystone.createProject(testProjectName,"Description goes here")
|
||||
#create test project
|
||||
|
|
|
@ -3,6 +3,7 @@ import json
|
|||
import ng_openstack.openstackRequest
|
||||
import ng_openstack.settings
|
||||
import os
|
||||
from ng_openstack.logger import log
|
||||
|
||||
class Openstack_Keystone():
|
||||
def __init__(self, requestor):
|
||||
|
@ -60,3 +61,17 @@ class Openstack_Keystone():
|
|||
if str(_endpoint['interface']).lower()==str(interface).lower():
|
||||
# print(_endpoint)
|
||||
return(_endpoint)
|
||||
|
||||
def createProject(_self,name,description):
|
||||
log.info("Creating a project")
|
||||
data={
|
||||
"project": {
|
||||
"description": description,
|
||||
"enabled": True,
|
||||
"is_domain": False,
|
||||
"name": name
|
||||
}
|
||||
}
|
||||
_self.newProjectData=_self.requestor.make_request("POST", "projects", data,
|
||||
os.getenv("OS_AUTH_URL")).json()
|
||||
return _self.newProjectData
|
Loading…
Reference in New Issue