• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python common.handle_error函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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


示例16: server_search

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


示例17: host_search

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


示例18: attr_search

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


示例19: store_delete

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


示例20: uuid_reserve

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



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python config.setup函数代码示例发布时间:2022-05-27
下一篇:
Python datautils.unpack函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap