# Path: lab/comms.py
# class connection(object):
#     """A descriptor for declaring connection types on role controllers
#     which does lazy loading of a ``Reliable`` proxy wrapper.
#     """
#     def __init__(self, key, **kwargs):
#         if key not in _registry:
#             raise KeyError(
#                 "No comms driver for {} has been registered".format(key))
#         self.key = key
#         self._proxies = {}
# 
#     def __get__(self, ctl, type=None):
#         if ctl is None:
#             return self
# 
#         # cache connections per location
#         proxy = self._proxies.get(ctl.location, None)
#         if proxy is None:
#             logging.debug("Creating new {} connection for {}"
#                           .format(self.key, ctl.location))
#             proxy = reliable_proxy(ctl.location, self.key)
#             self._proxies[ctl.location] = proxy
# 
#         return proxy


import inspect
import importlib
import pytest
import execnet
from builtins import object
from contextlib import contextmanager
from lab.comms import connection
from rpyc.utils.zerodeploy import DeployedServer
        from rpyc.experimental.splitbrain import (splitbrain,
                                                  disable_splitbrain)
#
# Copyright 2017 Sangoma Technologies Inc.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
"""
RPC controls
"""


class RPyCCtl(object):
    """Per location ``rpyc`` control.
    Offers connection factory methods as well as a cached master connection.
    """

# Path: lab/comms.py
# class connection(object):
#     """A descriptor for declaring connection types on role controllers
#     which does lazy loading of a ``Reliable`` proxy wrapper.
#     """
#     def __init__(self, key, **kwargs):
#         if key not in _registry:
#             raise KeyError(
#                 "No comms driver for {} has been registered".format(key))
#         self.key = key
#         self._proxies = {}
# 
#     def __get__(self, ctl, type=None):
#         if ctl is None:
#             return self
# 
#         # cache connections per location
#         proxy = self._proxies.get(ctl.location, None)
#         if proxy is None:
#             logging.debug("Creating new {} connection for {}"
#                           .format(self.key, ctl.location))
#             proxy = reliable_proxy(ctl.location, self.key)
#             self._proxies[ctl.location] = proxy
# 
#         return proxy


# Path: pytest_lab/rpc.py
import inspect
import importlib
import pytest
import execnet
from builtins import object
from contextlib import contextmanager
from lab.comms import connection
from rpyc.utils.zerodeploy import DeployedServer
        from rpyc.experimental.splitbrain import (splitbrain,
                                                  disable_splitbrain)

#
# Copyright 2017 Sangoma Technologies Inc.
#
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
"""
RPC controls
"""


class RPyCCtl(object):
    """Per location ``rpyc`` control.
    Offers connection factory methods as well as a cached master connection.
    """

    ssh = connection('ssh')