本文整理汇总了Python中rally.db.deployment_get函数的典型用法代码示例。如果您正苦于以下问题:Python deployment_get函数的具体用法?Python deployment_get怎么用?Python deployment_get使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了deployment_get函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_deployment_update_several
def test_deployment_update_several(self):
# Create a deployment and update it
deploy_one = db.deployment_create({})
self.assertEqual(deploy_one['config'], {})
update_deploy_one = db.deployment_update(
deploy_one['uuid'],
{'config': {'opt1': 'val1'}},
)
self.assertEqual(update_deploy_one['uuid'], deploy_one['uuid'])
self.assertEqual(update_deploy_one['config'], {'opt1': 'val1'})
get_deploy_one = db.deployment_get(deploy_one['uuid'])
self.assertEqual(get_deploy_one['uuid'], deploy_one['uuid'])
self.assertEqual(get_deploy_one['config'], {'opt1': 'val1'})
# Create another deployment
deploy_two = db.deployment_create({})
update_deploy_two = db.deployment_update(
deploy_two['uuid'],
{'config': {'opt2': 'val2'}},
)
self.assertEqual(update_deploy_two['uuid'], deploy_two['uuid'])
self.assertEqual(update_deploy_two['config'], {'opt2': 'val2'})
get_deploy_one_again = db.deployment_get(deploy_one['uuid'])
self.assertEqual(get_deploy_one_again['uuid'], deploy_one['uuid'])
self.assertEqual(get_deploy_one_again['config'], {'opt1': 'val1'})
开发者ID:danielmellado,项目名称:rally,代码行数:25,代码来源:test_api.py
示例2: test_deployment_get
def test_deployment_get(self):
deploy_one = db.deployment_create({'config': {'opt1': 'val1'}})
deploy_two = db.deployment_create({'config': {'opt2': 'val2'}})
get_deploy_one = db.deployment_get(deploy_one['uuid'])
get_deploy_two = db.deployment_get(deploy_two['uuid'])
self.assertNotEqual(get_deploy_one['uuid'], get_deploy_two['uuid'])
self.assertEqual(get_deploy_one['config'], {'opt1': 'val1'})
self.assertEqual(get_deploy_two['config'], {'opt2': 'val2'})
开发者ID:danielmellado,项目名称:rally,代码行数:8,代码来源:test_api.py
示例3: flavors
def flavors(self, deploy_id=None):
"""Show the flavors that are available in a deployment.
:param deploy_id: the UUID of a deployment
"""
headers = ['ID', 'Name', 'vCPUs', 'RAM (MB)', 'Swap (MB)', 'Disk (GB)']
mixed_case_fields = ['ID', 'Name', 'vCPUs']
float_cols = ['RAM (MB)', 'Swap (MB)', 'Disk (GB)']
formatters = dict(zip(float_cols,
[cliutils.pretty_float_formatter(col)
for col in float_cols]))
table_rows = []
try:
endpoints = db.deployment_get(deploy_id)['endpoints']
for endpoint_dict in endpoints:
clients = osclients.Clients(endpoint.Endpoint(**endpoint_dict))
nova_client = clients.nova()
for flavor in nova_client.flavors.list():
data = [flavor.id, flavor.name, flavor.vcpus,
flavor.ram, flavor.swap, flavor.disk]
table_rows.append(utils.Struct(**dict(zip(headers, data))))
except exceptions.InvalidArgumentsException:
print(_("Authentication Issues: %s") % sys.exc_info()[1])
return(1)
common_cliutils.print_list(table_rows,
fields=headers,
formatters=formatters,
mixed_case_fields=mixed_case_fields)
开发者ID:KevinTsang,项目名称:rally,代码行数:29,代码来源:show.py
示例4: images
def images(self, deploy_id=None):
"""Show the images that are available in a deployment.
:param deploy_id: the UUID of a deployment
"""
headers = ['UUID', 'Name', 'Size (B)']
mixed_case_fields = ['UUID', 'Name']
float_cols = ["Size (B)"]
table_rows = []
formatters = dict(zip(float_cols,
[cliutils.pretty_float_formatter(col)
for col in float_cols]))
try:
endpoints = db.deployment_get(deploy_id)['endpoints']
for endpoint_dict in endpoints:
clients = osclients.Clients(endpoint.Endpoint(**endpoint_dict))
glance_client = clients.glance()
for image in glance_client.images.list():
data = [image.id, image.name, image.size]
table_rows.append(utils.Struct(**dict(zip(headers, data))))
except exceptions.InvalidArgumentsException:
print(_("Authentication Issues: %s") % sys.exc_info()[1])
return(1)
common_cliutils.print_list(table_rows,
fields=headers,
formatters=formatters,
mixed_case_fields=mixed_case_fields)
开发者ID:KevinTsang,项目名称:rally,代码行数:28,代码来源:show.py
示例5: check
def check(self, deployment=None):
"""Check keystone authentication and list all available services.
:param deployment: a UUID or name of the deployment
"""
headers = ["services", "type", "status"]
table_rows = []
try:
admin = db.deployment_get(deployment)["admin"]
# TODO(boris-42): make this work for users in future
for endpoint_dict in [admin]:
clients = osclients.Clients(objects.Endpoint(**endpoint_dict))
client = clients.verified_keystone()
print("keystone endpoints are valid and following "
"services are available:")
for service in client.services.list():
data = [service.name, service.type, "Available"]
table_rows.append(utils.Struct(**dict(zip(headers, data))))
except exceptions.InvalidArgumentsException:
data = ["keystone", "identity", "Error"]
table_rows.append(utils.Struct(**dict(zip(headers, data))))
print(_("Authentication Issues: %s.")
% sys.exc_info()[1])
return(1)
cliutils.print_list(table_rows, headers)
开发者ID:briandowns,项目名称:rally,代码行数:26,代码来源:deployment.py
示例6: verify
def verify(deploy_id, image_id, alt_image_id, flavor_id, alt_flavor_id,
set_name, regex):
"""Start verifying.
:param deploy_id: a UUID of a deployment.
:param image_id: Valid primary image reference to be used in tests.
:param alt_image_id: Valid secondary image reference to be used in tests.
:param flavor_id: Valid primary flavor to use in tests.
:param alt_flavor_id: Valid secondary flavor to be used in tests.
:param set_name: Valid name of tempest test set.
"""
verifier = tempest.Tempest()
if not verifier.is_installed():
print("Tempest is not installed. "
"Please use 'rally-manage tempest install'")
return
print("Starting verification of deployment: %s" % deploy_id)
endpoints = db.deployment_get(deploy_id)['endpoints']
endpoint = endpoints[0]
verifier.verify(image_ref=image_id,
image_ref_alt=alt_image_id,
flavor_ref=flavor_id,
flavor_ref_alt=alt_flavor_id,
username=endpoint['username'],
password=endpoint['password'],
tenant_name=endpoint['tenant_name'],
uri=endpoint['auth_url'],
uri_v3=re.sub('/v2.0', '/v3', endpoint['auth_url']),
set_name=set_name,
regex=regex)
开发者ID:mohitsethi,项目名称:rally,代码行数:31,代码来源:api.py
示例7: config
def config(self, deploy_id=None):
"""Print on stdout a config of the deployment in JSON format.
:param deploy_id: a UUID of the deployment
"""
deploy = db.deployment_get(deploy_id)
print(json.dumps(deploy['config']))
开发者ID:RajalakshmiGanesan,项目名称:rally,代码行数:7,代码来源:deployment.py
示例8: check
def check(self, deploy_id=None):
"""Check the deployment.
Check keystone authentication and list all available services.
:param deploy_id: a UUID of the deployment
"""
headers = ['services', 'type', 'status']
table = prettytable.PrettyTable(headers)
try:
endpoints = db.deployment_get(deploy_id)['endpoints']
for endpoint_dict in endpoints:
clients = osclients.Clients(endpoint.Endpoint(**endpoint_dict))
client = clients.verified_keystone()
print("keystone endpoints are valid and following "
"services are available:")
for service in client.service_catalog.get_data():
table.add_row([service['name'], service['type'],
'Available'])
except exceptions.InvalidArgumentsException:
table.add_row(['keystone', 'identity', 'Error'])
print(_("Authentication Issues: %s.")
% sys.exc_info()[1])
return(1)
print(table)
开发者ID:pnavarro,项目名称:rally,代码行数:25,代码来源:deployment.py
示例9: check
def check(self, deploy_id=None):
"""Check the deployment.
Check keystone authentication and list all available services.
:param deploy_id: a UUID of the deployment
"""
headers = ['services', 'type', 'status']
table_rows = []
try:
endpoints = db.deployment_get(deploy_id)['endpoints']
for endpoint_dict in endpoints:
clients = osclients.Clients(endpoint.Endpoint(**endpoint_dict))
client = clients.verified_keystone()
print("keystone endpoints are valid and following "
"services are available:")
for service in client.service_catalog.get_data():
data = [service['name'], service['type'], 'Available']
table_rows.append(utils.Struct(**dict(zip(headers, data))))
except exceptions.InvalidArgumentsException:
data = ['keystone', 'identity', 'Error']
table_rows.append(utils.Struct(**dict(zip(headers, data))))
print(_("Authentication Issues: %s.")
% sys.exc_info()[1])
return(1)
common_cliutils.print_list(table_rows, headers)
开发者ID:RajalakshmiGanesan,项目名称:rally,代码行数:26,代码来源:deployment.py
示例10: test_deployment_update
def test_deployment_update(self):
deploy = db.deployment_create({})
self.assertEqual(deploy['config'], {})
update_deploy = db.deployment_update(deploy['uuid'],
{'config': {'opt': 'val'}})
self.assertEqual(update_deploy['uuid'], deploy['uuid'])
self.assertEqual(update_deploy['config'], {'opt': 'val'})
get_deploy = db.deployment_get(deploy['uuid'])
self.assertEqual(get_deploy['uuid'], deploy['uuid'])
self.assertEqual(get_deploy['config'], {'opt': 'val'})
开发者ID:danielmellado,项目名称:rally,代码行数:10,代码来源:test_api.py
示例11: config
def config(self, deployment=None):
"""Display configuration of the deployment.
Output is the configuration of the deployment in a
pretty-printed JSON format.
:param deployment: a UUID or name of the deployment
"""
deploy = db.deployment_get(deployment)
result = deploy["config"]
print(json.dumps(result, sort_keys=True, indent=4))
开发者ID:briandowns,项目名称:rally,代码行数:11,代码来源:deployment.py
示例12: endpoint
def endpoint(self, deploy_id=None):
"""Print endpoint of the deployment.
:param deploy_id: a UUID of the deployment
"""
headers = ['auth_url', 'username', 'password', 'tenant_name']
table = prettytable.PrettyTable(headers)
endpoints = db.deployment_get(deploy_id)['endpoints']
for ep in endpoints:
table.add_row([ep.get(m, '') for m in headers])
print(table)
开发者ID:Ch00k,项目名称:rally,代码行数:11,代码来源:deployment.py
示例13: endpoint
def endpoint(self, deploy_id=None):
"""Print endpoint of the deployment.
:param deploy_id: a UUID of the deployment
"""
headers = ['auth_url', 'username', 'password', 'tenant_name',
'region_name', 'use_public_urls', 'admin_port']
table_rows = []
endpoints = db.deployment_get(deploy_id)['endpoints']
for ep in endpoints:
data = [ep.get(m, '') for m in headers]
table_rows.append(utils.Struct(**dict(zip(headers, data))))
common_cliutils.print_list(table_rows, headers)
开发者ID:RajalakshmiGanesan,项目名称:rally,代码行数:12,代码来源:deployment.py
示例14: test_deployment_update_several
def test_deployment_update_several(self):
# Create a deployment and update it
deploy_one = db.deployment_create({})
self.assertEqual(deploy_one["config"], {})
update_deploy_one = db.deployment_update(
deploy_one["uuid"], {"config": {"opt1": "val1"}})
self.assertEqual(update_deploy_one["uuid"], deploy_one["uuid"])
self.assertEqual(update_deploy_one["config"], {"opt1": "val1"})
get_deploy_one = db.deployment_get(deploy_one["uuid"])
self.assertEqual(get_deploy_one["uuid"], deploy_one["uuid"])
self.assertEqual(get_deploy_one["config"], {"opt1": "val1"})
# Create another deployment
deploy_two = db.deployment_create({})
update_deploy_two = db.deployment_update(
deploy_two["uuid"], {"config": {"opt2": "val2"}})
self.assertEqual(update_deploy_two["uuid"], deploy_two["uuid"])
self.assertEqual(update_deploy_two["config"], {"opt2": "val2"})
get_deploy_one_again = db.deployment_get(deploy_one["uuid"])
self.assertEqual(get_deploy_one_again["uuid"], deploy_one["uuid"])
self.assertEqual(get_deploy_one_again["config"], {"opt1": "val1"})
开发者ID:Vaidyanath,项目名称:rally,代码行数:21,代码来源:test_api.py
示例15: start
def start(self, deploy_id=None, set_name='smoke', regex=None):
"""Start running tempest tests against a live cloud cluster.
:param deploy_id: a UUID of a deployment
:param set_name: Name of tempest test set
:param regex: Regular expression of test
"""
if regex:
set_name = 'full'
if set_name not in TEMPEST_TEST_SETS:
print('Sorry, but there are no desired tempest test set. '
'Please choose from: %s' % ', '.join(TEMPEST_TEST_SETS))
return(1)
endpoints = db.deployment_get(deploy_id)['endpoints']
endpoint_dict = endpoints[0]
clients = osclients.Clients(objects.Endpoint(**endpoint_dict))
glance = clients.glance()
image_list = []
for image in glance.images.list():
if 'cirros' in image.name:
image_list.append(image)
#TODO(miarmak): Add ability to upload new images if there are no
#necessary images in the cloud (cirros)
try:
image_id = image_list[0].id
alt_image_id = image_list[1].id
except IndexError:
print('Sorry, but there are no desired images or only one')
return(1)
nova = clients.nova()
flavor_list = []
for fl in sorted(nova.flavors.list(), key=lambda flavor: flavor.ram):
flavor_list.append(fl)
#TODO(miarmak): Add ability to create new flavors if they are missing
try:
flavor_id = flavor_list[0].id
alt_flavor_id = flavor_list[1].id
except IndexError:
print('Sorry, but there are no desired flavors or only one')
return(1)
#TODO(miarmak): Add getting network and router id's from neutronclient
api.verify(deploy_id, image_id, alt_image_id, flavor_id, alt_flavor_id,
set_name, regex)
开发者ID:marcoemorais,项目名称:rally,代码行数:52,代码来源:verify.py
示例16: keypairs
def keypairs(self, deploy_id=None):
headers = ['Name', 'Fingerprint']
table = prettytable.PrettyTable(headers)
try:
endpoints = db.deployment_get(deploy_id)['endpoints']
for endpoint_dict in endpoints:
clients = osclients.Clients(endpoint.Endpoint(**endpoint_dict))
nova_client = clients.nova()
for keypair in nova_client.keypairs.list():
table.add_row([keypair.name, keypair.fingerprint])
except exceptions.InvalidArgumentsException:
print(_("Authentication Issues: %s") % sys.exc_info()[1])
print(table)
开发者ID:Ch00k,项目名称:rally,代码行数:13,代码来源:show.py
示例17: networks
def networks(self, deploy_id=None):
headers = ['ID', 'Label', 'CIDR']
table = prettytable.PrettyTable(headers)
try:
endpoints = db.deployment_get(deploy_id)['endpoints']
for endpoint_dict in endpoints:
clients = osclients.Clients(endpoint.Endpoint(**endpoint_dict))
nova_client = clients.nova()
for network in nova_client.networks.list():
table.add_row([network.id, network.label, network.cidr])
except exceptions.InvalidArgumentsException:
print(_("Authentication Issues: %s") % sys.exc_info()[1])
print(table)
开发者ID:Ch00k,项目名称:rally,代码行数:13,代码来源:show.py
示例18: secgroups
def secgroups(self, deploy_id=None):
headers = ["ID", "Name", "Description"]
table = prettytable.PrettyTable(headers)
try:
endpoints = db.deployment_get(deploy_id)["endpoints"]
for endpoint_dict in endpoints:
clients = osclients.Clients(endpoint.Endpoint(**endpoint_dict))
nova_client = clients.nova()
for secgroup in nova_client.security_groups.list():
table.add_row([secgroup.id, secgroup.name, secgroup.description])
except exceptions.InvalidArgumentsException:
print(_("Authentication Issues: %s") % sys.exc_info()[1])
return 1
print(table)
开发者ID:pnavarro,项目名称:rally,代码行数:14,代码来源:show.py
示例19: endpoint
def endpoint(self, deploy_id):
"""Print endpoint of the deployment."""
attribute_map = [
('auth_url', 'uri'),
('user_name', 'admin_username'),
('password', 'admin_password'),
('tenant_name', 'admin_tenant_name'),
]
headers = [m[0] for m in attribute_map]
table = prettytable.PrettyTable(headers)
endpoint = db.deployment_get(deploy_id)['endpoint']
identity = endpoint.get('identity', {})
table.add_row([identity.get(m[1], '') for m in attribute_map])
print(table)
开发者ID:hughsaunders,项目名称:rally,代码行数:14,代码来源:main.py
示例20: images
def images(self, deploy_id=None):
"""Show the images that are available in a deployment.
:param deploy_id: the UUID of a deployment
"""
headers = ['UUID', 'Name', 'Size (B)']
table = prettytable.PrettyTable(headers)
try:
endpoints = db.deployment_get(deploy_id)['endpoints']
for endpoint_dict in endpoints:
clients = osclients.Clients(endpoint.Endpoint(**endpoint_dict))
glance_client = clients.glance()
for image in glance_client.images.list():
table.add_row([image.id, image.name, image.size])
except exceptions.InvalidArgumentsException:
print(_("Authentication Issues: %s") % sys.exc_info()[1])
print(table)
开发者ID:Ch00k,项目名称:rally,代码行数:17,代码来源:show.py
注:本文中的rally.db.deployment_get函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论