From c93636945c8688d07def1e49bcf38e6af80a11fc Mon Sep 17 00:00:00 2001 From: Marin Atanasov Nikolov Date: Fri, 28 Mar 2014 15:51:25 +0200 Subject: [PATCH] More logging in 'worker' module --- src/vpoller/worker.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/vpoller/worker.py b/src/vpoller/worker.py index c8c17de..d68fcde 100644 --- a/src/vpoller/worker.py +++ b/src/vpoller/worker.py @@ -429,6 +429,8 @@ def worker_db_init(self): hostnames, usernames, passwords, etc. """ + logging.info('Initializing vPoller Worker database at %s', self.worker_db) + if os.path.exists(self.worker_db): raise VPollerException, 'vPoller Worker database already exists at %s' % self.worker_db @@ -447,9 +449,9 @@ def worker_db_init(self): cursor.execute(sql) cursor.close() - def worker_db_add_agent(self, host, user, pwd, enabled): + def worker_db_add_update_agent(self, host, user, pwd, enabled): """ - Add/Update a vSphere Agent in the vPoller Worker database + Add/update a vSphere Agent in the vPoller Worker database Args: host (str): Hostname of the vSphere host @@ -458,6 +460,8 @@ def worker_db_add_agent(self, host, user, pwd, enabled): enabled (int): Enable or disable the vSphere Agent """ + logging.info('Adding/updating vSphere Agent %s in database', host) + conn = sqlite3.connect(self.worker_db) cursor = conn.cursor() @@ -473,6 +477,8 @@ def worker_db_remove_agent(self, host): host (str): Hostname of the vSphere Agent to remove """ + logging.info('Removing vSphere Agent %s from database', host) + conn = sqlite3.connect(self.worker_db) cursor = conn.cursor() @@ -488,6 +494,8 @@ def worker_db_get_agents(self, only_enabled=False): only_enabled (bool): If True return only the Agents which are enabled """ + logging.debug('Getting vSphere Agents from database') + conn = sqlite3.connect(self.worker_db) conn.row_factory = sqlite3.Row cursor = conn.cursor()