当前位置: 首页>>代码示例>>Python>>正文


Python common.handle_error函数代码示例

本文整理汇总了Python中spoke.lib.common.handle_error函数的典型用法代码示例。如果您正苦于以下问题:Python handle_error函数的具体用法?Python handle_error怎么用?Python handle_error使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了handle_error函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: create

def create(mac=None, template=None, run_id=None):
    '''
    Create a config for a specific MAC from a template
    run_id is optional

    CLI Examples::

        salt '*' tftp.create template='test.template' mac='11:22:33:44:55:66'
        salt '*' tftp.create template='test.template' mac='11:22:33:44:55:66'\\
        run_id=2590
    '''
    if mac is None or template is None:
        return "mac and template must be specified"
    conf = _spoke_config(_salt_config('config'))
    tftproot = conf.get("TFTP", "tftp_root")
    tftp = SpokeTFTP(tftproot)
    if run_id is None:
        try:
            result = tftp.create(mac, template)
        except error.SpokeError as e:
            result = common.handle_error(e)
    else:
        try:
            result = tftp.create(mac, template, run_id)
        except error.SpokeError as e:
            result = common.handle_error(e)
    return result
开发者ID:KrisSaxton,项目名称:spoke,代码行数:27,代码来源:tftp.py

示例2: subnet_create

def subnet_create(dhcp_server, subnet, mask, start_ip=None, stop_ip=None):
    try:
        from spoke.lib.dhcp import SpokeDHCPSubnet
        subnet= SpokeDHCPSubnet(dhcp_server)
        result = subnet.create(subnet, mask, start_ip, stop_ip)
    except error.SpokeError as e:
        result = common.handle_error(e)
    return result
开发者ID:mattmb,项目名称:spoke,代码行数:8,代码来源:dhcp.py

示例3: delete

def delete(network, mask):
    try:
        from spoke.lib.ip import SpokeSubnet
        subnet = SpokeSubnet(ip=network, mask=mask, dc=None)
        result = subnet.delete()
    except error.SpokeError as e:
        result = common.handle_error(e)
    return result
开发者ID:mattmb,项目名称:spoke,代码行数:8,代码来源:ip.py

示例4: release

def release(network, mask, ip):
    try:
        from spoke.lib.ip import SpokeSubnet
        subnet = SpokeSubnet(ip=network, mask=mask, dc=None)
        result = subnet.modify(release=ip, reserve=None)
    except error.SpokeError as e:
        result = common.handle_error(e)
    return result
开发者ID:mattmb,项目名称:spoke,代码行数:8,代码来源:ip.py

示例5: host_delete

def host_delete(org_name, host_name):
    try:
        conf = _spoke_config(_salt_config('config'))
        host = SpokeHost(org_name)
        result = host.delete(host_name)
    except error.SpokeError as e:
        result = common.handle_error(e)
    return result
开发者ID:KrisSaxton,项目名称:spoke,代码行数:8,代码来源:host.py

示例6: power_modify

def power_modify(vm_name, state):
    from spoke.lib.vm_power import SpokeVMPowerXen
    vmp = SpokeVMPowerXen(hv_uri, vm_name)
    try:
        result = vmp.modify(state)
    except error.SpokeError as e:
        result = common.handle_error(e)
    return result    
开发者ID:mattmb,项目名称:spoke,代码行数:8,代码来源:vm.py

示例7: power_search

def power_search(vm_name):
    from spoke.lib.vm_power import SpokeVMPowerXen
    vmp = SpokeVMPowerXen(hv_uri, vm_name)
    try:
        result = vmp.get()
    except error.SpokeError as e:
        result = common.handle_error(e)
    return result    
开发者ID:mattmb,项目名称:spoke,代码行数:8,代码来源:vm.py

示例8: uuid_create

def uuid_create(start_uuid=None, get_mac=False):
    try:
        conf = _spoke_config(_salt_config('config'))
        uuid = SpokeHostUUID()
        result = uuid.create(start_uuid, get_mac)
    except error.SpokeError as e:
        result = common.handle_error(e)
    return result
开发者ID:KrisSaxton,项目名称:spoke,代码行数:8,代码来源:host.py

示例9: uuid_delete

def uuid_delete():
    try:
        conf = _spoke_config(_salt_config('config'))
        uuid = SpokeHostUUID()
        result = uuid.delete()
    except error.SpokeError as e:
        result = common.handle_error(e)
    return result
开发者ID:KrisSaxton,项目名称:spoke,代码行数:8,代码来源:host.py

示例10: group_search

def group_search(dhcp_server, dhcp_group):
    try:
        from spoke.lib.dhcp import SpokeDHCPGroup
        group = SpokeDHCPGroup(dhcp_server)
        result = group.get(dhcp_group)
    except error.SpokeError as e:
        result = common.handle_error(e)
    return result
开发者ID:mattmb,项目名称:spoke,代码行数:8,代码来源:dhcp.py

示例11: subnet_search

def subnet_search(dhcp_server, subnet):
    try:
        from spoke.lib.dhcp import SpokeDHCPSubnet
        subnet = SpokeDHCPSubnet(dhcp_server)
        result = subnet.get(subnet)
    except error.SpokeError as e:
        result = common.handle_error(e)
    return result
开发者ID:mattmb,项目名称:spoke,代码行数:8,代码来源:dhcp.py

示例12: release

def release(network, mask, ip):
    try:
        conf = _spoke_config(_salt_config('config'))
        subnet = SpokeSubnet(ip=network, mask=mask, dc=None)
        result = subnet.modify(release=ip, reserve=None)
    except error.SpokeError as e:
        result = common.handle_error(e)
    return result
开发者ID:KrisSaxton,项目名称:spoke,代码行数:8,代码来源:ip.py

示例13: service_delete

def service_delete(service):
    try:
        from spoke.lib.dhcp import SpokeDHCPService
        service = SpokeDHCPService()
        result = service.delete(service)
    except error.SpokeError as e:
        result = common.handle_error(e)
    return result
开发者ID:mattmb,项目名称:spoke,代码行数:8,代码来源:dhcp.py

示例14: delete

def delete(network, mask):
    try:
        conf = _spoke_config(_salt_config('config'))
        subnet = SpokeSubnet(ip=network, mask=mask, dc=None)
        result = subnet.delete()
    except error.SpokeError as e:
        result = common.handle_error(e)
    return result
开发者ID:KrisSaxton,项目名称:spoke,代码行数:8,代码来源:ip.py

示例15: reservation_delete

def reservation_delete(dhcp_server, dhcp_group, host_name):
    try:
        from spoke.lib.dhcp import SpokeDHCPHost
        host = SpokeDHCPHost(dhcp_server, dhcp_group)
        result = host.delete(host_name)
    except error.SpokeError as e:
        result = common.handle_error(e)
    return result
开发者ID:mattmb,项目名称:spoke,代码行数:8,代码来源:dhcp.py


注:本文中的spoke.lib.common.handle_error函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。