Commit b1fd9bc7 authored by Kristopher Ruzic's avatar Kristopher Ruzic

check for table existence to fail a bit better

parent cd3ab8f8
...@@ -34,6 +34,17 @@ def get_connection_information(): ...@@ -34,6 +34,17 @@ def get_connection_information():
print "empty" print "empty"
return (None, None) return (None, None)
def check_tables():
conn = sqlite3.connect("/opt/slapos/slapproxy.db")
cur = conn.cursor()
qry = cur.execut("SELECT CASE WHEN tbl_name = 'partition11' THEN 1 ELSE 0 END FROM sqlite_master WHERE tbl_name = 'partition11' AND type = 'table'")
if qry:
pass
else:
print "tables aren't ready yet, your build may have failed, check logs in /opt/slapos/log/"
sys.exit(0)
def get_build_status(): def get_build_status():
try: try:
f = open("/opt/slapos/log/slapos-node-software-" + fmt_date() + ".log") f = open("/opt/slapos/log/slapos-node-software-" + fmt_date() + ".log")
...@@ -94,8 +105,10 @@ def main(argv): ...@@ -94,8 +105,10 @@ def main(argv):
usage() usage()
sys.exit() sys.exit()
elif opt in ("-s", "--status"): elif opt in ("-s", "--status"):
check_tables()
status() status()
elif opt in ("-i", "--info"): elif opt in ("-i", "--info"):
check_tables()
info() info()
elif opt in ("-d", "--dump"): elif opt in ("-d", "--dump"):
dump() dump()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment