mirror of
https://github.com/nextcloud/nextcloudpi.git
synced 2026-01-10 15:12:01 -03:30
install.sh: Fix ncp-provisioning not being executed on baremetal install
Signed-off-by: Tobias Knöppler <6317548+theCalcaholic@users.noreply.github.com>
This commit is contained in:
parent
61ba6a63fa
commit
fa793b3173
3
.github/workflows/vm-tests.yml
vendored
3
.github/workflows/vm-tests.yml
vendored
@ -145,6 +145,9 @@ jobs:
|
||||
setup-ssh-port-forwarding "$SERVER_ADDRESS"
|
||||
|
||||
echo "Run integration tests"
|
||||
set -x
|
||||
ssh -o "StrictHostKeyChecking=no" -o "UserKnownHostsFile=/dev/null" "root@${SERVER_ADDRESS}" cat /usr/local/etc/instance.cfg
|
||||
set +x
|
||||
test-ncp-instance -a -f "$SNAPSHOT_ID" -b "${VERSION}" "root@${SERVER_ADDRESS}" "localhost" "8443" "9443" || {
|
||||
|
||||
echo "Integration tests failed"
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
# this script runs at startup to provide an unique random passwords for each instance
|
||||
|
||||
source /usr/local/etc/library.sh
|
||||
|
||||
set -x
|
||||
## redis provisioning
|
||||
|
||||
CFG=/var/www/nextcloud/config/config.php
|
||||
@ -79,6 +79,7 @@ fi
|
||||
"cohorteId": ${cohorte_id}
|
||||
}
|
||||
EOF
|
||||
cat /usr/local/etc/instance.cfg
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -35,10 +35,12 @@ apt-get install --no-install-recommends -y git ca-certificates sudo lsb-release
|
||||
# get install code
|
||||
if [[ "${CODE_DIR}" == "" ]]; then
|
||||
echo "Getting build code..."
|
||||
CODE_DIR="${TEMPDIR}"/nextcloudpi
|
||||
git clone -b "${BRANCH}" https://github.com/nextcloud/nextcloudpi.git "${CODE_DIR}"
|
||||
CODE_DIR_TMP="${TEMPDIR}"/nextcloudpi
|
||||
git clone -b "${BRANCH}" https://github.com/nextcloud/nextcloudpi.git "${CODE_DIR_TMP}"
|
||||
cd "$CODE_DIR_TMP"
|
||||
else
|
||||
cd "${CODE_DIR}"
|
||||
fi
|
||||
cd "${CODE_DIR}"
|
||||
|
||||
# install NCP
|
||||
echo -e "\nInstalling NextCloudPi..."
|
||||
|
||||
@ -12,6 +12,7 @@ Use at your own risk!
|
||||
More at https://ownyourbits.com
|
||||
"""
|
||||
import json
|
||||
import subprocess
|
||||
|
||||
pre_cmd = []
|
||||
|
||||
@ -192,11 +193,17 @@ def test_autoupdates():
|
||||
r.stderr.decode('utf-8') if r.stderr else '')
|
||||
|
||||
def set_cohorte_id(cohorte_id: int) -> CompletedProcess:
|
||||
r = handle_error(run(pre_cmd + ['cat', '/usr/local/etc/instance.cfg'], stdout=PIPE, stderr=PIPE))
|
||||
proc = subprocess.Popen(pre_cmd + ['cat', '/usr/local/etc/instance.cfg'], stdout=subprocess.PIPE, shell=False)
|
||||
#handle_error(run(pre_cmd + ['cat', '/usr/local/etc/instance.cfg'], stdout=subprocess.STDOUT, stderr=subprocess.STDOUT))
|
||||
#r = handle_error(run(pre_cmd + ['cat', '/usr/local/etc/instance.cfg'], stdout=PIPE, stderr=PIPE))
|
||||
(out, err) = proc.communicate()
|
||||
if proc.returncode != 0:
|
||||
raise ProcessExecutionException()
|
||||
try:
|
||||
instance_cfg = json.loads(r.stdout)
|
||||
instance_cfg = json.loads(out)
|
||||
except json.decoder.JSONDecodeError as e:
|
||||
print(f"{tc.red}error{tc.normal} instance.cfg could not be parsed, was: {r.stdout}")
|
||||
print(f"{tc.red}error{tc.normal} /usr/local/etc/instance.cfg could not be parsed, was: {out}\n{err}")
|
||||
print(f"Command: '{' '.join(pre_cmd + ['cat', '/usr/local/etc/instance.cfg'])}'")
|
||||
raise e
|
||||
|
||||
instance_cfg['cohorteId'] = cohorte_id
|
||||
@ -209,7 +216,7 @@ def test_autoupdates():
|
||||
print(f"{tc.yellow}skipped{tc.normal} (already updated to v99.99.99)")
|
||||
return True
|
||||
handle_error(run(pre_cmd + ['rm', '-f', '/var/run/.ncp-latest-version']))
|
||||
result = handle_error(run(pre_cmd + ['sed', '-i', 's|BRANCH="master"|BRANCH="testing/staged-rollouts-1"|', '/usr/local/bin/ncp-check-version'], stdout=PIPE, stderr=PIPE))
|
||||
handle_error(run(pre_cmd + ['sed', '-i', 's|BRANCH="master"|BRANCH="testing/staged-rollouts-1"|', '/usr/local/bin/ncp-check-version'], stdout=PIPE, stderr=PIPE))
|
||||
set_cohorte_id(1)
|
||||
result = run(pre_cmd + ['test', '-f', '/var/run/.ncp-latest-version'], stdout=PIPE, stderr=PIPE)
|
||||
if result.returncode == 0:
|
||||
@ -323,7 +330,7 @@ if __name__ == "__main__":
|
||||
tc.yellow + ssh_cmd + tc.normal + "...")
|
||||
binaries_must_be_installed = binaries_must_be_installed + binaries_no_docker
|
||||
pre_cmd = ['ssh', '-o UserKnownHostsFile=/dev/null' , '-o PasswordAuthentication=no',
|
||||
'-o StrictHostKeyChecking=no', '-o ConnectTimeout=1', ssh_cmd[4:]]
|
||||
'-o StrictHostKeyChecking=no', '-o ConnectTimeout=10', ssh_cmd[4:]]
|
||||
|
||||
if not skip_ping:
|
||||
at_char = ssh_cmd.index('@')
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user