updates
This commit is contained in:
parent
ae6c397120
commit
3b9e7329ff
|
|
@ -10,8 +10,8 @@ import random
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
INSENV = ".env-nextc"
|
INSENV = ".env-nextc"
|
||||||
DOCOMP = "docker-compose"
|
DOCOMP = ("docker", "compose")
|
||||||
USRCMP = ("sudo", DOCOMP, "exec", "-u", "1000")
|
USRCMP = ("sudo",) + DOCOMP + ("exec", "-u", "1000")
|
||||||
|
|
||||||
if not os.path.exists("docker-compose.yml"):
|
if not os.path.exists("docker-compose.yml"):
|
||||||
raise ProgramError("Needs to be run from compose directory\n")
|
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))
|
ROOTPASS = "".join(random.choices(string.ascii_uppercase + string.digits, k=10))
|
||||||
print ("...setting")
|
print ("...setting")
|
||||||
cmd = USRCMP + ("nextc-db", "mysqladmin", "-u", "root", "password", ROOTPASS)
|
cmd = USRCMP + ("nextc-db", "mysqladmin", "-u", "root", "password", ROOTPASS)
|
||||||
print (cmd)
|
|
||||||
try:
|
try:
|
||||||
out = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True, text=True)
|
out = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True, text=True)
|
||||||
except subprocess.CalledProcessError as err:
|
except subprocess.CalledProcessError as err:
|
||||||
print (err.stderr)
|
print (err.stderr)
|
||||||
print (err.stdout)
|
|
||||||
raise ProgramError("Failure to create DB password")
|
raise ProgramError("Failure to create DB password")
|
||||||
with open (INSENV, 'a') as out:
|
with open (INSENV, 'a') as out:
|
||||||
print("ROOTPASS=" + ROOTPASS, file=out)
|
print("ROOTPASS=" + ROOTPASS, file=out)
|
||||||
|
|
@ -85,8 +83,8 @@ def main():
|
||||||
cmd = USRCMP + ("-w", "/config/www/nextcloud", "nextc", "php", "occ", "status")
|
cmd = USRCMP + ("-w", "/config/www/nextcloud", "nextc", "php", "occ", "status")
|
||||||
try:
|
try:
|
||||||
out = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True, text=True)
|
out = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True, text=True)
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError as err:
|
||||||
print(out.stderr)
|
print(err.stderr)
|
||||||
raise ProgramError("Failure to check install status (" + out.stderr + ")")
|
raise ProgramError("Failure to check install status (" + out.stderr + ")")
|
||||||
if "installed:" not in out.stdout:
|
if "installed:" not in out.stdout:
|
||||||
raise ProgramError("No result from install status test")
|
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)
|
out = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=True, text=True)
|
||||||
except subprocess.CalledProcessError as err:
|
except subprocess.CalledProcessError as err:
|
||||||
print(err.stderr)
|
print(err.stderr)
|
||||||
print(err.stdout)
|
|
||||||
raise ProgramError("Failure to install")
|
raise ProgramError("Failure to install")
|
||||||
print("...success")
|
print("...success")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue