Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 11 additions & 6 deletions proxstar/starrs.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
import logging

logging.basicConfig(format='%(asctime)s %(levelname)s %(message)s', level=logging.INFO)


def get_next_ip(starrs, range_name):
c = starrs.cursor()
try:
Expand All @@ -7,7 +12,7 @@ def get_next_ip(starrs, range_name):
results = c.fetchall()
c.execute('COMMIT')
except Exception as e:
print(e)
logging.exception(e)
starrs.rollback()
finally:
c.close()
Expand All @@ -23,7 +28,7 @@ def get_ip_for_mac(starrs, mac):
results = c.fetchall()
c.execute('COMMIT')
except Exception as e:
print(e)
logging.exception(e)
starrs.rollback()
finally:
c.close()
Expand All @@ -41,7 +46,7 @@ def renew_ip(starrs, addr):
results = c.fetchall()
c.execute('COMMIT')
except Exception as e:
print(e)
logging.exception(e)
starrs.rollback()
finally:
c.close()
Expand Down Expand Up @@ -79,7 +84,7 @@ def check_hostname(starrs, hostname):
available = False
c.execute('COMMIT')
except Exception as e:
print(e)
logging.exception(e)
valid = False
available = False
starrs.rollback()
Expand All @@ -104,7 +109,7 @@ def register_starrs(starrs, name, owner, mac, addr):
c.callproc('api.modify_system', (name, 'comment', f'Owned by {owner}'))
c.execute('COMMIT')
except Exception as e:
print(e)
logging.exception(e)
starrs.rollback()
finally:
c.close()
Expand All @@ -120,7 +125,7 @@ def delete_starrs(starrs, name):
results = c.fetchall()
c.execute('COMMIT')
except Exception as e:
print(e)
logging.exception(e)
starrs.rollback()
finally:
c.close()
Expand Down