def __init__(self): self.cpe_obj = None self.dpe_obj = None self.conn = cqpid.Connection('localhost:49000') self.conn.open() self.session = qmf2.ConsoleSession(self.conn) self.session.setAgentFilter('[]') self.session.open() self.l = logging.getLogger() time.sleep(3) agents = self.session.getAgents() for a in agents: self.l.debug('agent: %s' % str(a)) if 'cloudpolicyengine.org' in a.getVendor(): result = a.query( "{class:cpe, package:'org.cloudpolicyengine'}") if len(result) >= 1: self.cpe_obj = result[0] if self.cpe_obj is None: print '' print 'No cpe agent!, aaarrggg' print '' sys.exit(3)
def __init__(self, logger): self.cpe_obj = None self.conn = cqpid.Connection('localhost:49000') self.conn.open() self.session = qmf2.ConsoleSession(self.conn) self.session.setAgentFilter('[]') self.session.open() self.l = logger attempts = 0 while self.cpe_obj is None: agents = self.session.getAgents() for a in agents: self.l.debug('agent: %s' % str(a)) if 'pacemakercloud.org' in a.getVendor(): result = a.query( "{class:cpe, package:'org.pacemakercloud'}") if len(result) >= 1: self.cpe_obj = result[0] if self.cpe_obj is None: attempts = attempts + 1 if attempts > 50: print '*** Could not find cped agent...' sys.exit(3) else: time.sleep(0.1)
def __init__(self): threading.Thread.__init__(self) self.connection = cqpid.Connection('localhost:49000', '') self.connection.open() self.session = qmf2.ConsoleSession(self.connection) self.session.open() self.session.setAgentFilter( "[eq, _vendor, [quote, 'pacemakercloud.org']]") self.receiver = eventreceiver.EventReceiver(self.session)
from services import ServicesTest, ServicesLib, ServicesImpl MATAHARI_PACKAGE = 'matahariproject.org' if len(sys.argv) < 2: broker = "localhost:49000" else: broker = sys.argv[1] ### QMF connection print "Creating session...", sys.stdout.flush() connection = cqpid.Connection(broker) connection.open() session = qmf2.ConsoleSession(connection) session.open() session.setAgentFilter("[]") print " DONE" ### DBus def getDBus(obj, path, iface): try: return DBus(bus.get_object(obj, path), iface) except Exception as e: print "Unable to create DBus object (%s). DBus tests of object %s will be disabled." % ( e.message, obj) return None