Esempio n. 1
0
 def __bdm_call(self, *params):
     cmd_p = [SUID_BLOCKDEV_MGR]
     cmd_p.extend(params)
     proc = Subprocess(" ".join(cmd_p), shell=False)
     stdout_value, stderr_value = proc.communicate()
     if proc.returncode != 0:
         out = stdout_value
         if stderr_value:
             out += "\n%s" % stderr_value
         raise Exception(out)
    def exec_openssl(cls, command, stdin=None, cwd=None):
        '''Run openssl command. PKI_OPENSSL_BIN doesn't need to be specified'''
        c = [os.environ.get('OPENSSL_EXEC', 'openssl')]
        c.extend(command)

        try:
            proc = Subprocess(c, with_input=True) 
            stdout_value, stderr_value = proc.communicate(stdin)

            out = stdout_value
            if stderr_value:
                out += '\n%s'%stderr_value
            if proc.returncode != 0:
                logger.warning('OpenSSL error: %s'%out)
        except Exception, err:
            logger.error('openssl call error! "%s" failed: %s'%(' '.join(c), err))
            raise err
Esempio n. 3
0
    def exec_openssl(cls, command, stdin=None, cwd=None):
        '''Run openssl command. PKI_OPENSSL_BIN doesn't need to be specified'''
        c = [os.environ.get('OPENSSL_EXEC', 'openssl')]
        c.extend(command)

        try:
            proc = Subprocess(c, with_input=True)
            stdout_value, stderr_value = proc.communicate(stdin)

            out = stdout_value
            if stderr_value:
                out += '\n%s' % stderr_value
            if proc.returncode != 0:
                logger.warning('OpenSSL error: %s' % out)
        except Exception, err:
            logger.error('openssl call error! "%s" failed: %s' %
                         (' '.join(c), err))
            raise err