本文整理汇总了Python中vcd_cli.utils.stderr函数的典型用法代码示例。如果您正苦于以下问题:Python stderr函数的具体用法?Python stderr怎么用?Python stderr使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了stderr函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: delete_firewall_rule_service
def delete_firewall_rule_service(ctx, name, id, protocol):
try:
firewall_rule_resource = get_firewall_rule(ctx, name, id)
firewall_rule_resource.delete_firewall_rule_service(protocol)
stdout('Firewall rule\'s service deleted successfully', ctx)
except Exception as e:
stderr(e, ctx)
示例2: list_ipsec_vpn
def list_ipsec_vpn(ctx, gateway_name):
try:
gateway_resource = get_gateway(ctx, gateway_name)
result = gateway_resource.list_ipsec_vpn()
stdout(result, ctx)
except Exception as e:
stderr(e, ctx)
示例3: info_ipsec_vpn
def info_ipsec_vpn(ctx, gateway_name, id):
try:
ipsec_vpn_obj = get_ipsec_vpn(ctx, gateway_name, id)
result = ipsec_vpn_obj.get_vpn_site_info()
stdout(result, ctx)
except Exception as e:
stderr(e, ctx)
示例4: info_activation_status
def info_activation_status(ctx, gateway_name):
try:
gateway_resource = get_gateway(ctx, gateway_name)
result = gateway_resource.info_activation_status_ipsec_vpn()
stdout(result, ctx)
except Exception as e:
stderr(e, ctx)
示例5: info_logging_settings
def info_logging_settings(ctx, gateway_name):
try:
gateway_resource = get_gateway(ctx, gateway_name)
result = gateway_resource.info_logging_settings_ipsec_vpn()
stdout(result, ctx)
except Exception as e:
stderr(e, ctx)
示例6: list_service_certificate
def list_service_certificate(ctx, gateway_name):
try:
gateway_resource = get_gateway(ctx, gateway_name)
result = gateway_resource.list_service_certificates()
stdout(result, ctx)
except Exception as e:
stderr(e, ctx)
示例7: delete_ipsec_vpn
def delete_ipsec_vpn(ctx, gateway_name, id):
try:
ipsec_vpn_obj = get_ipsec_vpn(ctx, gateway_name, id)
ipsec_vpn_obj.delete_ipsec_vpn()
stdout('IPsec VPN deleted successfully.', ctx)
except Exception as e:
stderr(e, ctx)
示例8: delete_dhcp_pool
def delete_dhcp_pool(ctx, gateway_name, pool_id):
try:
resource = get_dhcp_pool(ctx, gateway_name, pool_id)
resource.delete_pool()
stdout('DHCP Pool deleted successfully.', ctx)
except Exception as e:
stderr(e, ctx)
示例9: list_dhcp_pool
def list_dhcp_pool(ctx, gateway_name):
try:
gateway_resource = get_gateway(ctx, gateway_name)
result = gateway_resource.list_dhcp_pools()
stdout(result, ctx)
except Exception as e:
stderr(e, ctx)
示例10: create
def create(ctx, name, pvdc_name, network_pool_name, allocation_model, sp_name,
sp_limit, description, cpu_allocated, cpu_limit):
try:
restore_session(ctx)
client = ctx.obj['client']
in_use_org_href = ctx.obj['profiles'].get('org_href')
org = Org(client, in_use_org_href)
storage_profiles = [{
'name': sp_name,
'enabled': True,
'units': 'MB',
'limit': sp_limit,
'default': True
}]
vdc_resource = org.create_org_vdc(
name,
pvdc_name,
network_pool_name=network_pool_name,
description=description,
allocation_model=allocation_model,
cpu_allocated=cpu_allocated,
cpu_limit=cpu_limit,
storage_profiles=storage_profiles,
uses_fast_provisioning=True,
is_thin_provision=True)
stdout(vdc_resource.Tasks.Task[0], ctx)
except Exception as e:
stderr(e, ctx)
示例11: create_isolated_network
def create_isolated_network(ctx, name, gateway_ip, netmask, description,
primary_dns_ip, secondary_dns_ip, dns_suffix,
ip_range_start, ip_range_end, is_dhcp_enabled,
default_lease_time, max_lease_time,
dhcp_ip_range_start, dhcp_ip_range_end, is_shared):
try:
restore_session(ctx, vdc_required=True)
client = ctx.obj['client']
in_use_vdc_href = ctx.obj['profiles'].get('vdc_href')
vdc = VDC(client, href=in_use_vdc_href)
prefix_len = netmask_to_cidr_prefix_len(gateway_ip, netmask)
network_cidr = gateway_ip + '/' + str(prefix_len)
result = vdc.create_isolated_vdc_network(
network_name=name,
network_cidr=network_cidr,
description=description,
primary_dns_ip=primary_dns_ip,
secondary_dns_ip=secondary_dns_ip,
dns_suffix=dns_suffix,
ip_range_start=ip_range_start,
ip_range_end=ip_range_end,
is_dhcp_enabled=is_dhcp_enabled,
default_lease_time=default_lease_time,
max_lease_time=max_lease_time,
dhcp_ip_range_start=dhcp_ip_range_start,
dhcp_ip_range_end=dhcp_ip_range_end,
is_shared=is_shared)
stdout(result.Tasks.Task[0], ctx)
except Exception as e:
stderr(e, ctx)
示例12: use
def use(ctx, name):
try:
restore_session(ctx)
client = ctx.obj['client']
in_use_org_name = ctx.obj['profiles'].get('org_in_use')
orgs = client.get_org_list()
for org_resource in orgs:
if org_resource.get('name').lower() == in_use_org_name.lower():
for link in get_links(org_resource,
media_type=EntityType.VDC.value):
if link.name == name:
vdc_in_use = name
vapp_in_use = ''
vapp_href = ''
client.get_resource(link.href)
ctx.obj['profiles'].set('vdc_in_use', vdc_in_use)
ctx.obj['profiles'].set('vdc_href', str(link.href))
ctx.obj['profiles'].set('vapp_in_use', vapp_in_use)
ctx.obj['profiles'].set('vapp_href', vapp_href)
message = 'now using org: \'%s\', vdc: \'%s\', vApp:' \
' \'%s\'.' % (in_use_org_name, vdc_in_use,
vapp_in_use)
stdout({
'org': in_use_org_name,
'vdc': vdc_in_use,
'vapp': vapp_in_use
}, ctx, message)
return
raise Exception('Org \'%s\' not found' % in_use_org_name)
except Exception as e:
stderr(e, ctx)
示例13: capture
def capture(ctx, name, catalog, template, customizable, description):
try:
restore_session(ctx, vdc_required=True)
client = ctx.obj['client']
in_use_org_href = ctx.obj['profiles'].get('org_href')
org = Org(client, in_use_org_href)
catalog_resource = org.get_catalog(catalog)
vdc_href = ctx.obj['profiles'].get('vdc_href')
vdc = VDC(client, href=vdc_href)
vapp_resource = vdc.get_vapp(name)
overwrite = False
if template is None:
template = vapp_resource.get('name')
else:
overwrite = True
task = org.capture_vapp(
catalog_resource,
vapp_href=vapp_resource.get('href'),
catalog_item_name=template,
description=description,
customize_on_instantiate=customizable == 'customizable',
overwrite=overwrite)
stdout(task, ctx)
except Exception as e:
stderr(e, ctx)
示例14: create
def create(ctx, name, description, catalog, template, network, memory, cpu,
disk_size, ip_allocation_mode, vm_name, hostname, storage_profile,
accept_all_eulas):
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)
if catalog is None and template is None:
vapp_resource = vdc.create_vapp(
name,
description=description,
network=network,
accept_all_eulas=accept_all_eulas)
else:
vapp_resource = vdc.instantiate_vapp(
name,
catalog,
template,
description=description,
network=network,
memory=memory,
cpu=cpu,
disk_size=disk_size,
deploy=True,
power_on=True,
accept_all_eulas=accept_all_eulas,
cust_script=None,
ip_allocation_mode=ip_allocation_mode,
vm_name=vm_name,
hostname=hostname,
storage_profile=storage_profile)
stdout(vapp_resource.Tasks.Task[0], ctx)
except Exception as e:
stderr(e, ctx)
示例15: create
def create(ctx, user_name, password, role_name, full_name, description, email,
telephone, im, enabled, alert_enabled, alert_email,
alert_email_prefix, external, default_cached, group_role,
stored_vm_quota, deployed_vm_quota):
try:
if len(password) < 6:
raise Exception('Password must be at least 6 characters long.')
restore_session(ctx)
client = ctx.obj['client']
in_use_org_href = ctx.obj['profiles'].get('org_href')
org = Org(client, in_use_org_href)
role = org.get_role_record(role_name)
role_href = role.get('href')
result = org.create_user(
user_name=user_name,
password=password,
role_href=role_href,
full_name=full_name,
description=description,
email=email,
telephone=telephone,
im=im,
alert_email=alert_email,
alert_email_prefix=alert_email_prefix,
stored_vm_quota=stored_vm_quota,
deployed_vm_quota=deployed_vm_quota,
is_group_role=group_role,
is_default_cached=default_cached,
is_external=external,
is_alert_enabled=alert_enabled,
is_enabled=enabled)
stdout('User \'%s\' is successfully created.' % result.get('name'),
ctx)
except Exception as e:
stderr(e, ctx)