def untar(self, packagePath, untarPath, nicelevel):
        ''' do real untar '''
        cmd = ['tar', '-C', untarPath, '-x', '-f', packagePath]
        # timeout 60 minute
        execThread = ExecThread(None, cmd, None, self.getUuid())
        execThread.setTimeout(3600)
        execThread.run()

        status = execThread.getStatus()
        if (status['error'] != None):
            msg = 'untar cmd (%s) failed (%s - %s)' % (' '.join(cmd), status['error'], status['errorMsg'])
            LOG.error(msg)
            raise AgentException(Errors.PACKAGE_UNTAR_FAILURE, msg)
Exemple #2
0
    def _executeCommand(self, cmd, timeout = 2, service = None):
        ''' execute command '''
        execThread = ExecThread(None, cmd)
        execThread.setLogLevel('debug')
        execThread.run()

        # now wait for the threads to complete and update progress
        status = execThread.getStatus()
        if (status['error'] != None):
            return None
#             raise AgentException(status['error'], status['errorMsg'])

        return status['result']
    def untar(self, packagePath, untarPath, nicelevel):
        ''' do real untar '''
        cmd = ['tar', '-C', untarPath, '-x', '-f', packagePath]
        # timeout 60 minute
        execThread = ExecThread(None, cmd, None)
        execThread.setTimeout(3600)
        execThread.run()

        status = execThread.getStatus()
        if (status['error'] != None):
            msg = 'untar cmd (%s) failed (%s - %s)' % (' '.join(cmd), status['error'], status['errorMsg'])
            LOG.error(msg)
            raise AgentException(Errors.PACKAGE_UNTAR_FAILURE, msg)