コード例 #1
0
    def _run(self, command, timeout=None, ignore_status=False):
        """
        Auxiliary function to run a command, with proper shell escaping.

        @param timeout: Timeout to run the command.
        @param ignore_status: Whether we should supress error.CmdError
                exceptions if the command did return exit code !=0 (True), or
                not supress them (False).
        """
        return utils.run(r"%s" % (utils.sh_escape(command)), timeout, ignore_status)
コード例 #2
0
    def _run(self, command, timeout=None, ignore_status=False):
        """
        Auxiliary function to run a command, with proper shell escaping.

        @param timeout: Timeout to run the command.
        @param ignore_status: Whether we should supress error.CmdError
                exceptions if the command did return exit code !=0 (True), or
                not supress them (False).
        """
        return utils.run(r'%s' % (utils.sh_escape(command)), timeout,
                         ignore_status)
コード例 #3
0
    def __init__(self, repodir, giturl=None, weburl=None, abs_work_tree=None):
        """
        Initialized reposotory.

        @param repodir: destination repo directory.
        @param giturl: master repo git url.
        @param weburl: a web url for the master repo.
        @param abs_work_tree: work tree of the git repo. In the
            absence of a work tree git manipulations will occur
            in the current working directory for non bare repos.
            In such repos the -git-dir option should point to
            the .git directory and -work-tree should point to
            the repos working tree.
        Note: a bare reposotory is one which contains all the
        working files (the tree) and the other wise hidden files
        (.git) in the same directory. This class assumes non-bare
        reposotories.
        """
        if repodir is None:
            raise ValueError('You must provide a path that will hold the'
                             'git repository')
        self.repodir = utils.sh_escape(repodir)
        self._giturl = giturl
        if weburl is not None:
            warnings.warn(
                "Param weburl: You are no longer required to provide "
                "a web URL for your git repos", DeprecationWarning)

        # path to .git dir
        self.gitpath = utils.sh_escape(os.path.join(self.repodir, '.git'))

        # Find git base command. If not found, this will throw an exception
        self.git_base_cmd = os_dep.command('git')
        self.work_tree = abs_work_tree

        # default to same remote path as local
        self._build = os.path.dirname(self.repodir)
コード例 #4
0
    def __init__(self, repodir, giturl, weburl=None):
        if repodir is None:
            raise ValueError('You must provide a path that will hold the'
                             'git repository')
        self.repodir = utils.sh_escape(repodir)
        if giturl is None:
            raise ValueError('You must provide a git URL repository')
        self.giturl = giturl
        if weburl is not None:
            warnings.warn(
                "Param weburl: You are no longer required to provide "
                "a web URL for your git repos", DeprecationWarning)

        # path to .git dir
        self.gitpath = utils.sh_escape(os.path.join(self.repodir, '.git'))

        # Find git base command. If not found, this will throw an exception
        git_base_cmd = os_dep.command('git')

        # base git command , pointing to gitpath git dir
        self.gitcmdbase = '%s --git-dir=%s' % (git_base_cmd, self.gitpath)

        # default to same remote path as local
        self._build = os.path.dirname(self.repodir)
コード例 #5
0
    def __init__(self, repodir, giturl, weburl=None):
        if repodir is None:
            raise ValueError("You must provide a path that will hold the" "git repository")
        self.repodir = utils.sh_escape(repodir)
        if giturl is None:
            raise ValueError("You must provide a git URL repository")
        self.giturl = giturl
        if weburl is not None:
            warnings.warn(
                "Param weburl: You are no longer required to provide " "a web URL for your git repos",
                DeprecationWarning,
            )

        # path to .git dir
        self.gitpath = utils.sh_escape(os.path.join(self.repodir, ".git"))

        # Find git base command. If not found, this will throw an exception
        git_base_cmd = os_dep.command("git")

        # base git command , pointing to gitpath git dir
        self.gitcmdbase = "%s --git-dir=%s" % (git_base_cmd, self.gitpath)

        # default to same remote path as local
        self._build = os.path.dirname(self.repodir)
コード例 #6
0
 def path_exists(self, path):
     """Determine if path existes on the remote machien"""
     result = self.run('ls %s > /dev/null' % utils.sh_escape(path),
                       ignore_status=True)
     return result.exit_status == 0
コード例 #7
0
ファイル: hosts.py プロジェクト: open-estuary/caliper
 def path_exists(self, path):
     """Determine if path existes on the remote machien"""
     result = self.run('ls %s > /dev/null' % utils.sh_escape(path),
                         ignore_status=True)
     return result.exit_status == 0