This commit is contained in:
Andrew Hurley 2022-11-19 03:01:15 +00:00
parent ae6c397120
commit 3b9e7329ff
1 changed files with 4 additions and 7 deletions

View File

@ -10,8 +10,8 @@ import random
def main():
INSENV = ".env-nextc"
DOCOMP = "docker-compose"
USRCMP = ("sudo", DOCOMP, "exec", "-u", "1000")
DOCOMP = ("docker", "compose")
USRCMP = ("sudo",) + DOCOMP + ("exec", "-u", "1000")
if not os.path.exists("docker-compose.yml"):
raise ProgramError("Needs to be run from compose directory\n")
@ -53,12 +53,10 @@ def main():
ROOTPASS = "".join(random.choices(string.ascii_uppercase + string.digits, k=10))
print ("...setting")
cmd = USRCMP + ("nextc-db", "mysqladmin", "-u", "root", "password", ROOTPASS)
print (cmd)
try:
out = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True, text=True)
except subprocess.CalledProcessError as err:
print (err.stderr)
print (err.stdout)
raise ProgramError("Failure to create DB password")
with open (INSENV, 'a') as out:
print("ROOTPASS=" + ROOTPASS, file=out)
@ -85,8 +83,8 @@ def main():
cmd = USRCMP + ("-w", "/config/www/nextcloud", "nextc", "php", "occ", "status")
try:
out = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True, text=True)
except subprocess.CalledProcessError:
print(out.stderr)
except subprocess.CalledProcessError as err:
print(err.stderr)
raise ProgramError("Failure to check install status (" + out.stderr + ")")
if "installed:" not in out.stdout:
raise ProgramError("No result from install status test")
@ -104,7 +102,6 @@ def main():
out = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True, text=True)
except subprocess.CalledProcessError as err:
print(err.stderr)
print(err.stdout)
raise ProgramError("Failure to install")
print("...success")