Commit 0778b08c authored by Kristopher Ruzic's avatar Kristopher Ruzic

fixed bugs in wendelin-show to make it useable (looks for right xml key), also...

fixed bugs in wendelin-show to make it useable (looks for right xml key), also replace erp5 with wendelin
parent df741bae
...@@ -18,7 +18,7 @@ def fmt_date(): ...@@ -18,7 +18,7 @@ def fmt_date():
def get_connection_information(): def get_connection_information():
conn = sqlite3.connect("/opt/slapos/slapproxy.db") conn = sqlite3.connect("/opt/slapos/slapproxy.db")
cur = conn.cursor() cur = conn.cursor()
qry = cur.execute("SELECT connection_xml FROM partition11 WHERE connection_xml IS NOT NULL AND software_type='create-erp5-site'") qry = cur.execute("SELECT connection_xml FROM partition11 WHERE connection_xml IS NOT NULL AND software_type='default'")
for row in qry: for row in qry:
xml = str(row[0]) xml = str(row[0])
break break
...@@ -27,12 +27,11 @@ def get_connection_information(): ...@@ -27,12 +27,11 @@ def get_connection_information():
try: try:
el = instance.getElementsByTagName('parameter')[0] el = instance.getElementsByTagName('parameter')[0]
value = el.childNodes[0].nodeValue value = el.childNodes[0].nodeValue
json_text = json.loads(value) return value
return (json_text['family-admin'], json_text['inituser-password'])
except Exception, e: except Exception, e:
print e print e
print "empty" print "empty"
return (None, None) return None
def check_tables(): def check_tables():
conn = sqlite3.connect("/opt/slapos/slapproxy.db") conn = sqlite3.connect("/opt/slapos/slapproxy.db")
...@@ -65,10 +64,9 @@ def get_build_status(): ...@@ -65,10 +64,9 @@ def get_build_status():
def status(): def status():
build = get_build_status() build = get_build_status()
if build: if build:
zope_ip, pw = get_connection_information() zope_ip = get_connection_information()
print ("Build successful, connect to:\n" print ("Build successful, connect to:\n"
" " + zope_ip + " with\n" " " + zope_ip + " to access your Wendelin instance")
" username: zope password: " + pw)
elif not build: elif not build:
print "Your software is still building, be patient it can take awhile" print "Your software is still building, be patient it can take awhile"
elif build == "err": elif build == "err":
...@@ -77,12 +75,13 @@ def status(): ...@@ -77,12 +75,13 @@ def status():
def info(): def info():
if get_build_status(): if get_build_status():
print "Your wendelin instance can be found at: "
print get_connection_information() print get_connection_information()
else: else:
print "Information unavailable at this time, run " + sys.argv[0] + " -s for details" print "Information unavailable at this time, run " + sys.argv[0] + " -s for details"
def usage(): def usage():
print ("Get the status and information of your ERP5 build\n" print ("Get the status and information of your Wendelin build\n"
"Usage:") "Usage:")
print (" --help (-h): Print this message and exit\n" print (" --help (-h): Print this message and exit\n"
" --status (-s): Print the status of the build\n" " --status (-s): Print the status of the build\n"
...@@ -99,6 +98,9 @@ def main(argv): ...@@ -99,6 +98,9 @@ def main(argv):
except getopt.error, msg: except getopt.error, msg:
usage() usage()
sys.exit(2) sys.exit(2)
if len(opts) == 0:
usage()
sys.exit(2)
# process arguments # process arguments
for opt, arg in opts: for opt, arg in opts:
if opt in ("-h", "--help"): if opt in ("-h", "--help"):
......
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