Ejemplo n.º 1
0
class BaseHandler(object):

    def __init__(self, resources, handlers=None):
        self.resources = resources
        if handlers is None:
            self.transport_sync = SSHSyncTransport()
            self.transport_run = SSHRunTransport()
        else:
            self.transport_run = handlers['run']()
            self.transport_sync = handlers['sync']()
        self.transport_sync.bind_with(self.transport_run)
        self.transport_run.bind_with(self.transport_sync)

    def verify_run_result(self, cmd, result):
        rc, out, err = result
        log.debug('CMD %r RC %s OUT %s ERR %s', cmd, rc, out, err)
        if rc:
            message = 'CMD %r failed RC %s ERR %s' % (cmd, rc, err)
            raise errors.SolarError(message)

    def __enter__(self):
        return self

    def __exit__(self, exc, value, traceback):
        return
Ejemplo n.º 2
0
class BaseHandler(object):
    def __init__(self, resources, handlers=None):
        self.resources = resources
        if handlers is None:
            self.transport_sync = SSHSyncTransport()
            self.transport_run = SSHRunTransport()
        else:
            self.transport_run = handlers['run']()
            self.transport_sync = handlers['sync']()
        self.transport_sync.bind_with(self.transport_run)
        self.transport_run.bind_with(self.transport_sync)

    def verify_run_result(self, cmd, result):
        rc, out, err = result.return_code, result.stdout, result.stderr
        log.debug('CMD %r RC %s OUT %s ERR %s', cmd, rc, out, err)
        if not result.success:
            message = 'CMD %r failed RC %s ERR %s' % (cmd, rc, err)
            log.error(message)
            raise errors.SolarError(result.output)

    def __enter__(self):
        return self

    def __exit__(self, exc, value, traceback):
        return
Ejemplo n.º 3
0
 def __init__(self, resources, handlers=None):
     self.resources = resources
     if handlers is None:
         self.transport_sync = SSHSyncTransport()
         self.transport_run = SSHRunTransport()
     else:
         self.transport_run = handlers['run']()
         self.transport_sync = handlers['sync']()
     self.transport_sync.bind_with(self.transport_run)
     self.transport_run.bind_with(self.transport_sync)
Ejemplo n.º 4
0
class BaseHandler(object):
    def __init__(self, resources, handlers=None):
        self.resources = resources
        if handlers is None:
            self.transport_sync = SSHSyncTransport()
            self.transport_run = SSHRunTransport()
        else:
            self.transport_run = handlers['run']()
            self.transport_sync = handlers['sync']()
        self.transport_sync.bind_with(self.transport_run)
        self.transport_run.bind_with(self.transport_sync)

    def __enter__(self):
        return self

    def __exit__(self, exc, value, traceback):
        return
Ejemplo n.º 5
0
Archivo: base.py Proyecto: CGenie/solar
class BaseHandler(object):

    def __init__(self, resources, handlers=None):
        self.resources = resources
        if handlers is None:
            self.transport_sync = SSHSyncTransport()
            self.transport_run = SSHRunTransport()
        else:
            self.transport_run = handlers['run']()
            self.transport_sync = handlers['sync']()
        self.transport_sync.bind_with(self.transport_run)
        self.transport_run.bind_with(self.transport_sync)

    def __enter__(self):
        return self

    def __exit__(self, exc, value, traceback):
        return
Ejemplo n.º 6
0
 def __init__(self, resources, handlers=None):
     self.resources = resources
     if handlers is None:
         self.transport_sync = SSHSyncTransport()
         self.transport_run = SSHRunTransport()
     else:
         self.transport_run = handlers['run']()
         self.transport_sync = handlers['sync']()
     self.transport_sync.bind_with(self.transport_run)
     self.transport_run.bind_with(self.transport_sync)