Exemple #1
0
    def _copy_testplan_package(self):
        """Make testplan package available on remote host"""

        module_path = os.path.dirname(module_abspath(testplan))
        self._testplan_import_path.local = os.path.abspath(
            os.path.join(module_path, '..'))

        if self.cfg.testplan_path:
            self._testplan_import_path.remote = self.cfg.testplan_path
            return

        # test if testplan package is available on remote host
        cmd = remote_filepath_exists(self.cfg.ssh_cmd, self.ssh_cfg,
                                     self._testplan_import_path.local)
        if 0 == execute_cmd(cmd,
                            label='testplan package availability check',
                            check=False,
                            logger=self.logger):  # exists on remote

            self._testplan_import_path.remote = self._testplan_import_path.local

        else:  # copy to remote
            self._testplan_import_path.remote = os.path.join(
                self._remote_testplan_path, 'testplan_lib')
            # as module_path has no trailing /
            # this will copy the entire testplan subdir to testplan_lib
            self._transfer_data(source=module_path,
                                target=self._testplan_import_path.remote,
                                remote_target=True,
                                deref_links=True)
Exemple #2
0
    def _copy_testplan_package(self):
        """Make testplan package available on remote host"""

        self._testplan_import_path.local = self._get_testplan_import_path()

        if self.cfg.testplan_path:
            self._testplan_import_path.remote = self.cfg.testplan_path
            return

        # test if testplan package is available on remote host
        cmd = remote_filepath_exists(self.cfg.ssh_cmd, self.ssh_cfg,
                                     self._testplan_import_path.local)
        if 0 == execute_cmd(
                cmd,
                label="testplan package availability check",
                check=False,
                logger=self.logger,
        ):  # exists on remote

            self._testplan_import_path.remote = (
                self._testplan_import_path.local)

        else:  # copy to remote
            self._testplan_import_path.remote = os.path.join(
                self._remote_testplan_path, "testplan_lib")
            # add trailing / to _testplan_import_path.local
            # this will copy everything under import path to to testplan_lib
            self._transfer_data(
                source=os.path.join(self._testplan_import_path.local, ""),
                target=self._testplan_import_path.remote,
                remote_target=True,
                deref_links=True,
            )