Ejemplo n.º 1
0
 def get_options(cls):
     """
     Schema for options validation and assignment of default values.
     """
     hostname = socket.gethostbyname(socket.gethostname())
     return {
         'hosts':
         dict,
         ConfigOption('abort_signals',
                      default=[signal.SIGINT, signal.SIGTERM]): [int],
         ConfigOption('worker_type', default=RemoteWorker):
         object,
         ConfigOption('pool_type', default='thread'):
         str,
         ConfigOption('host', default=hostname):
         str,
         ConfigOption('port', default=0):
         int,
         ConfigOption('copy_cmd', default=copy_cmd):
         lambda x: callable(x),
         ConfigOption('link_cmd', default=link_cmd):
         lambda x: callable(x),
         ConfigOption('ssh_cmd', default=ssh_cmd):
         lambda x: callable(x),
         ConfigOption('workspace', default=workspace_root()):
         str,
         ConfigOption('workspace_exclude', default=[]):
         Or(list, None),
         ConfigOption('remote_workspace', default=None):
         Or(str, None),
         ConfigOption('copy_workspace_check',
                      default=remote_filepath_exists):
         Or(lambda x: callable(x), None),
         ConfigOption('env', default=None):
         Or(dict, None),
         ConfigOption('setup_script', default=None):
         Or(list, None),
         ConfigOption('push', default=[]):
         Or(list, None),
         ConfigOption('push_exclude', default=[]):
         Or(list, None),
         ConfigOption('push_relative_dir', default=None):
         Or(str, None),
         ConfigOption('delete_pushed', default=False):
         bool,
         ConfigOption('pull', default=[]):
         Or(list, None),
         ConfigOption('pull_exclude', default=[]):
         Or(list, None),
         ConfigOption('remote_mkdir', default=['/bin/mkdir', '-p']):
         list,
         ConfigOption('testplan_path', default=None):
         Or(str, None),
         ConfigOption('worker_heartbeat', default=30):
         Or(int, float, None)
     }
Ejemplo n.º 2
0
class RemotePoolConfig(PoolConfig):
    """
    Configuration object for
    :py:class:`~testplan.runners.pools.remote.RemotePool` executor
    resource entity.
    """

    default_hostname = socket.gethostbyname(socket.gethostname())
    default_workspace_root = workspace_root()

    @classmethod
    def get_options(cls):
        """
        Schema for options validation and assignment of default values.
        """
        return {
            "hosts":
            dict,
            ConfigOption("abort_signals",
                         default=[signal.SIGINT, signal.SIGTERM]): [int],
            ConfigOption("worker_type", default=RemoteWorker):
            object,
            ConfigOption("pool_type", default="thread"):
            str,
            ConfigOption("host", default=cls.default_hostname):
            str,
            ConfigOption("port", default=0):
            int,
            ConfigOption("copy_cmd", default=copy_cmd):
            lambda x: callable(x),
            ConfigOption("link_cmd", default=link_cmd):
            lambda x: callable(x),
            ConfigOption("ssh_cmd", default=ssh_cmd):
            lambda x: callable(x),
            ConfigOption("workspace", default=cls.default_workspace_root):
            str,
            ConfigOption("workspace_exclude", default=[]):
            Or(list, None),
            ConfigOption("remote_workspace", default=None):
            Or(str, None),
            ConfigOption("copy_workspace_check",
                         default=remote_filepath_exists):
            Or(lambda x: callable(x), None),
            ConfigOption("env", default=None):
            Or(dict, None),
            ConfigOption("setup_script", default=None):
            Or(list, None),
            ConfigOption("push", default=[]):
            Or(list, None),
            ConfigOption("push_exclude", default=[]):
            Or(list, None),
            ConfigOption("push_relative_dir", default=None):
            Or(str, None),
            ConfigOption("delete_pushed", default=False):
            bool,
            ConfigOption("pull", default=[]):
            Or(list, None),
            ConfigOption("pull_exclude", default=[]):
            Or(list, None),
            ConfigOption("remote_mkdir", default=["/bin/mkdir", "-p"]):
            list,
            ConfigOption("testplan_path", default=None):
            Or(str, None),
            ConfigOption("worker_heartbeat", default=30):
            Or(int, float, None),
        }