Skip to content

Commit

Permalink
More logging in 'worker' module
Browse files Browse the repository at this point in the history
  • Loading branch information
dnaeon committed Mar 28, 2014
1 parent ae4cd74 commit c936369
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/vpoller/worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand All @@ -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()

Expand All @@ -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()

Expand All @@ -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()
Expand Down

0 comments on commit c936369

Please sign in to comment.