Пример #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
def configure_forwarders():
    cfg = json.loads(config()["port-forwards"])
    update_port_forwards(cfg)
Пример #6
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()
Пример #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()