コード例 #1
0
def forward_from_config_and_relation(relation):
    """Forward ports from config and relations if opened-ports relation is available"""
    services = relation.opened_ports
    cfg = json.loads(config()["port-forwards"])
    if not sanity_check_cfg(cfg):
        return
    services.extend(cfg)
    update_port_forwards(services)
    services = relation.set_ready()
コード例 #2
0
def forward_from_config_and_relation(relation):
    """Forward ports from config and relations if opened-ports relation is available"""
    services = relation.opened_ports
    cfg = json.loads(config()["port-forwards"])
    if not sanity_check_cfg(cfg):
        return
    services.extend(cfg)
    update_port_forwards(services)
    services = relation.set_ready()
コード例 #3
0
def forward_from_config():
    """Only forward ports from config if no opened-ports relation is available"""
    try:
        cfg = json.loads(config()["port-forwards"])
    except ValueError:
        hookenv.status_set(
            'blocked',
            'Failed to parse "port-forwards". Please make sure this is valid json.')
        exit()
    if not sanity_check_cfg(cfg):
        return
    update_port_forwards(cfg)
コード例 #4
0
def forward_from_config():
    """Only forward ports from config if no opened-ports relation is available"""
    try:
        cfg = json.loads(config()["port-forwards"])
    except ValueError:
        hookenv.status_set(
            'blocked',
            'Failed to parse "port-forwards". Please make sure this is valid json.')
        exit()
    if not sanity_check_cfg(cfg):
        return
    update_port_forwards(cfg)
コード例 #5
0
ファイル: dhcp_server.py プロジェクト: galgalesh/tengu-charms
def configure_forwarders():
    cfg = json.loads(config()["port-forwards"])
    update_port_forwards(cfg)
コード例 #6
0
ファイル: dhcp_server.py プロジェクト: galgalesh/tengu-charms
def configure_port_forwards(relation):
    services = relation.opened_ports
    cfg = json.loads(config()["port-forwards"])
    services.extend(cfg)
    update_port_forwards(services)
    services = relation.set_ready()
コード例 #7
0
def configure_forwarders():
    cfg = json.loads(config()["port-forwards"])
    update_port_forwards(cfg)
コード例 #8
0
def configure_port_forwards(relation):
    services = relation.opened_ports
    cfg = json.loads(config()["port-forwards"])
    services.extend(cfg)
    update_port_forwards(services)
    services = relation.set_ready()