Esempio n. 1
0
def get_existing_configuration_uuid() -> Optional[str]:
    uuid = get_uuid()
    if uuid is None:
        return None
    client = get_client()
    connection = client.get_connection_by_uuid(uuid)
    if connection is None:
        return None
    else:
        return uuid
Esempio n. 2
0
def save_connection(client: 'NM.Client', config, private_key, certificate, callback=None):
    _logger.info("writing configuration to Network Manager")
    new_con = import_ovpn(config, private_key, certificate)
    uuid = get_uuid()
    if uuid:
        old_con = client.get_connection_by_uuid(uuid)
        if old_con:
            update_connection(old_con, new_con, callback)
            return
    add_connection(client=client, connection=new_con, callback=callback)
Esempio n. 3
0
def deactivate():
    """
    Deactivates an existing configuration
    """
    deactivate_connection_with_mainloop(get_uuid())
Esempio n. 4
0
def activate():
    """
    Activates an existing configuration
    """
    refresh()
    activate_connection_with_mainloop(get_uuid())
Esempio n. 5
0
 def test_activate_connection(self):
     get_client()
     get_uuid()
Esempio n. 6
0
 def test_get_uuid(self):
     get_uuid()
Esempio n. 7
0
 def test_activate_connection(self):
     client = get_client()
     uuid = get_uuid()
Esempio n. 8
0
 def test_get_uuid(self):
     uuid = get_uuid()