Ejemplo n.º 1
0
    def _is_available(self):
        """ which puppet
        """
        if ecm.is_windows():
            return ecm.which('puppet.exe')

        return ecm.which('puppet')
Ejemplo n.º 2
0
    def _is_available(self):
        """ checks if git is on path
        """
        if ecm.is_windows():
            return ecm.which('git.exe')

        return ecm.which('git')
Ejemplo n.º 3
0
    def cmd_command_exists(self, *argv, **kwargs):
        """Syntax: command.exists[command]"""

        command = kwargs.get('command', None)

        if not command:
            raise ecm.InvalidParameters(self.cmd_command_exists.__doc__)

        return bool(ecm.which(command))
Ejemplo n.º 4
0
    def _extract_alternative(self, filename):
        """ extractor helper: Try to extract file using system commands
        """
        from shutil import move
        from os import path

        file_type = self._get_file_type(filename)

        # Move file before decompress
        move(filename, self.working_dir)
        filename = path.join(self.working_dir, path.basename(filename))

        if file_type == 'zip':
            package = 'unzip'
            command = 'unzip'
            args = [filename]

        elif file_type == 'gz':
            package = 'gzip'
            command = 'gunzip'
            args = [filename]

        elif file_type == 'bz2':
            package = 'bzip2'
            command = 'bzip2'
            args = ['-d', filename]

        else:
            raise Exception("Unsupported file compression")

        exists = ecm.which(command)
        if not exists:
            # Try to install package
            ecm.install_package(package)
            exists = ecm.which(command)

        if exists and command:
            # Decompress
            out, stdout, stderr = ecm.run_command(command, args, workdir=self.working_dir)
            ret = {'out': out, 'stderr': stderr, 'stdout': stdout}
            return ret

        raise Exception("Could not extract file")
Ejemplo n.º 5
0
 def _is_available(self):
     """ it's salt-call on path?
     """
     if ecm.is_windows():
         return ecm.which('salt-call.exe')
     return ecm.which('salt-call')
Ejemplo n.º 6
0
 def _is_available(self):
     """ is svn on path
     """
     if ecm.is_windows():
         return ecm.which('svn.cmd')
     return ecm.which('svn')