Exemple #1
0
	def __init__(self, database_uri=None, dbname=None):
		'''
		Create a Server object, initiate connection and set up the databse URI 
		(Not particulary in that order :-)
		Oh and also sync up the views from the on disk storage onto CouchDB
		so we can use them for our maintainance operations.
		'''
		self.logger = configuration.get_logger(logging_instance=conflictlogging,
							system_name='dbmaintainer')
		configuration.info(self.logger)
		self.logger.info('Database maintainer starting.')
		if not database_uri:
			database_uri = "http://127.0.0.1:5984"
		if not dbname:
			dbname = 'session_store'
		self.dbname = dbname
		self.db_uri = database_uri
		self.dbserver = Server(self.db_uri)
		loader = FileSystemDocsLoader('/root/relaxession/_design/')
		try:
			self.db = self.dbserver.get_or_create_db(self.dbname)
			loader.sync(self.db, verbose=True)
		except Exception as e:
			self.logger.info('Init error: %s' % e)
			sys.exit(1)
		self.db.res.put('/_revs_limit',str(configuration.REVS_LIMIT))
Exemple #2
0
 def __init__(self, hosts, available, offline):
     self.logger = configuration.get_logger(logging_instance=connlogging, system_name="connmanager")
     self.hosts = hosts
     self.available = available
     self.offline = offline
     for i in self.hosts:
         self.queue.put(i)
Exemple #3
0
 def __init__(self, hosts, database_name="session_store"):
     self.logger = configuration.get_logger(logging_instance=connlogging, system_name="connmanager")
     configuration.info(self.logger)
     self.database_name = database_name
     self.hosts = hosts
     self.online = []
     self.ip = self.get_ip_address()
     self.logger.info("= ConnectionManager instantiated =")
     self.logger.info("My IP -> %s" % self.ip)
     self.logger.info("Targets: %s" % self.hosts)
     # Create an instance to the local server
     self.dbserver = Server()
     self.node_probe = None  # reference for the NodeProbe object
Exemple #4
0
 def __init__(self, targets_queue, online_list, offline_list):
     self.targets_queue = targets_queue  # get a reference to the targets holding queue.
     self.online_list = online_list  # get a reference to the online_list for populating it
     self.offline_list = offline_list  # ditto
     self.logger = configuration.get_logger(logging_instance=connlogging, system_name="connmanager")
     Thread.__init__(self)