本文整理汇总了Python中pyvcloud.vcd.vapp.VApp.change_owner方法的典型用法代码示例。如果您正苦于以下问题:Python VApp.change_owner方法的具体用法?Python VApp.change_owner怎么用?Python VApp.change_owner使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyvcloud.vcd.vapp.VApp
的用法示例。
在下文中一共展示了VApp.change_owner方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_11_change_owner
# 需要导入模块: from pyvcloud.vcd.vapp import VApp [as 别名]
# 或者: from pyvcloud.vcd.vapp.VApp import change_owner [as 别名]
def test_11_change_owner(self):
logged_in_org = self.client.get_org()
org = Org(self.client, resource=logged_in_org)
vdc_resource = org.get_vdc(self.config['vcd']['vdc'])
user_resource = org.get_user(self.config['vcd']['new_vapp_user'])
vdc = VDC(self.client, href=vdc_resource.get('href'))
vapp_resource = vdc.get_vapp(self.config['vcd']['vapp'])
vapp = VApp(self.client, resource=vapp_resource)
vapp.change_owner(user_resource.get('href'))
vapp_resource = vdc.get_vapp(self.config['vcd']['vapp'])
assert self.config['vcd']['new_vapp_user'] == \
vapp_resource.Owner.User.get('name')
示例2: change_owner
# 需要导入模块: from pyvcloud.vcd.vapp import VApp [as 别名]
# 或者: from pyvcloud.vcd.vapp.VApp import change_owner [as 别名]
def change_owner(ctx, vapp_name, user_name):
try:
restore_session(ctx, vdc_required=True)
client = ctx.obj['client']
vdc_href = ctx.obj['profiles'].get('vdc_href')
vdc = VDC(client, href=vdc_href)
in_use_org_href = ctx.obj['profiles'].get('org_href')
org = Org(client, in_use_org_href)
user_resource = org.get_user(user_name)
vapp_resource = vdc.get_vapp(vapp_name)
vapp = VApp(client, resource=vapp_resource)
vapp.change_owner(user_resource.get('href'))
stdout('vapp owner changed', ctx)
except Exception as e:
stderr(e, ctx)