Searching projectS
This commit is contained in:
parent
3b4e13697d
commit
48b9345fc0
13
main.py
13
main.py
|
@ -17,4 +17,15 @@ x.keystone.getCatalog()
|
|||
# print(neutronService)
|
||||
# neutronURL=x.keystone.getEndpointByNameIDAndInterface("NeuTrOn","internal")['url']
|
||||
# print(neutronURL)
|
||||
projects=x.keystone.getAllProjects()
|
||||
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):
|
||||
|
@ -59,4 +60,18 @@ class Openstack_Keystone():
|
|||
if str(_endpoint['service_id']).lower()==str(id).lower():
|
||||
if str(_endpoint['interface']).lower()==str(interface).lower():
|
||||
# print(_endpoint)
|
||||
return(_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
|
|
@ -59,16 +59,16 @@ class Openstack_Request:
|
|||
},
|
||||
"identity": {
|
||||
"password": {
|
||||
"user": {
|
||||
"domain": {
|
||||
"name": authDomain
|
||||
},
|
||||
"password": password,
|
||||
"name": username
|
||||
}
|
||||
"user": {
|
||||
"domain": {
|
||||
"name": authDomain
|
||||
},
|
||||
"password": password,
|
||||
"name": username
|
||||
}
|
||||
},
|
||||
"methods": [
|
||||
"password"
|
||||
"password"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue