本文整理汇总了Python中pyvcloud.vcd.org.Org.get_catalog_resource方法的典型用法代码示例。如果您正苦于以下问题:Python Org.get_catalog_resource方法的具体用法?Python Org.get_catalog_resource怎么用?Python Org.get_catalog_resource使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyvcloud.vcd.org.Org
的用法示例。
在下文中一共展示了Org.get_catalog_resource方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_02_change_catalog_owner
# 需要导入模块: from pyvcloud.vcd.org import Org [as 别名]
# 或者: from pyvcloud.vcd.org.Org import get_catalog_resource [as 别名]
def test_02_change_catalog_owner(self):
logged_in_org = self.client.get_org()
org = Org(self.client, resource=logged_in_org)
org.change_catalog_owner(self.config['vcd']['catalog'],
self.config['vcd']['new_catalog_owner'])
catalog_resource = org.get_catalog_resource(
self.config['vcd']['catalog'], True)
assert self.config['vcd']['new_catalog_owner'] \
== catalog_resource.Owner.User.get('name')
示例2: _fill_in_netpool_default
# 需要导入模块: from pyvcloud.vcd.org import Org [as 别名]
# 或者: from pyvcloud.vcd.org.Org import get_catalog_resource [as 别名]
_fill_in_netpool_default(client, vdc_kwargs)
# Now create the VDC.
admin_vdc_resource = org.create_org_vdc(**vdc_kwargs)
# The 'admin_vdc_resource' is not a task but an AdminVdc entity. Tasks
# are two levels down.
handle_task(client, admin_vdc_resource.Tasks.Task[0])
org.reload()
vdc_resource = org.get_vdc(cfg.vdc['vdc_name'])
vdc = VDC(client, resource=vdc_resource)
print("VDC now exists: {0}".format(vdc.name))
# Ensure the catalog exists. For now we don't do anything special with
# permissions. As with VDC's we reload the org if we create a catalog
# so that it's visible in future calls.
try:
catalog_resource = org.get_catalog_resource(cfg.catalog['name'])
print("Catalog already exists: {0}".format(cfg.catalog['name']))
except Exception:
print("Catalog does not exist, creating: {0}".format(cfg.catalog['name']))
catalog_kwargs = cfg.catalog
catalog_resource = org.create_catalog(**catalog_kwargs)
org.reload()
print("Catalog now exists: {0}".format(catalog_resource.get('name')))
# Check for catalog_items containing OVF templates in the catalog and
# upload them if they are missing.
for catalog_item in cfg.catalog_items:
try:
catalog_item_resource = org.get_catalog_item(
catalog_item['catalog_name'], catalog_item['item_name'])
print("Catalog item exists: {0}".format(catalog_item['item_name']))