vmcheck/overlay: Drop dependency on host Python
Also switch to using `jq` on the controlling host instead of Python. This is also prep for switching CI to FCOS which is likely to not ship Python at all. There are still spots a bit everywhere where we currently assume Python on the target host. We'll have to address those soon. Closes: #1828 Approved by: cgwalters
This commit is contained in:
parent
c89f81c138
commit
9f618d0acc
@ -1,5 +1,5 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -euo pipefail
|
set -xeuo pipefail
|
||||||
|
|
||||||
# Execute this code path on the host
|
# Execute this code path on the host
|
||||||
if test -z "${INSIDE_VM:-}"; then
|
if test -z "${INSIDE_VM:-}"; then
|
||||||
@ -13,34 +13,31 @@ if test -z "${INSIDE_VM:-}"; then
|
|||||||
|
|
||||||
vm_rsync
|
vm_rsync
|
||||||
|
|
||||||
|
vm_rpmostree status --json > ${VM}-out.json
|
||||||
|
commit=$(jq -r '.deployments[0]["checksum"]' < ${VM}-out.json)
|
||||||
|
origin=$(jq -r '.deployments[0]["origin"]' < ${VM}-out.json)
|
||||||
|
version=$(jq -r '.deployments[0]["version"]' < ${VM}-out.json)
|
||||||
|
timestamp=$(jq -r '.deployments[0]["timestamp"]' < ${VM}-out.json)
|
||||||
|
rm -f ${VM}-out.json
|
||||||
|
|
||||||
vm_cmd env \
|
vm_cmd env \
|
||||||
RPMOSTREE_TEST_NO_OVERLAY="${RPMOSTREE_TEST_NO_OVERLAY:-}" \
|
RPMOSTREE_TEST_NO_OVERLAY="${RPMOSTREE_TEST_NO_OVERLAY:-}" \
|
||||||
INSIDE_VM=1 /var/roothome/sync/tests/vmcheck/overlay.sh
|
INSIDE_VM=1 /var/roothome/sync/tests/vmcheck/overlay.sh \
|
||||||
|
$commit $origin $version $timestamp
|
||||||
vm_reboot
|
vm_reboot
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
set -x
|
|
||||||
|
|
||||||
# And then this code path in the VM
|
# And then this code path in the VM
|
||||||
|
|
||||||
# get details from the current default deployment
|
# get details from the current default deployment
|
||||||
rpm-ostree status --json > json.txt
|
rpm-ostree status --json > json.txt
|
||||||
json_field() {
|
commit=$1; shift
|
||||||
field=$1; shift;
|
origin=$1; shift
|
||||||
python -c "
|
version=$1; shift
|
||||||
import sys, json;
|
timestamp=$1; shift
|
||||||
deployment = json.load(open('json.txt'))['deployments'][0]
|
|
||||||
print deployment.get('$field', '')
|
|
||||||
exit()"
|
|
||||||
}
|
|
||||||
commit=$(json_field checksum)
|
|
||||||
origin=$(json_field origin)
|
|
||||||
version=$(json_field version)
|
|
||||||
timestamp=$(json_field timestamp)
|
|
||||||
[ -n "$timestamp" ]
|
[ -n "$timestamp" ]
|
||||||
timestamp=$(date -d "@$timestamp" "+%b %d %Y")
|
timestamp=$(date -d "@$timestamp" "+%b %d %Y")
|
||||||
rm -f json.txt
|
|
||||||
|
|
||||||
if [[ -z $commit ]] || ! ostree rev-parse $commit; then
|
if [[ -z $commit ]] || ! ostree rev-parse $commit; then
|
||||||
echo "Error while determining current commit" >&2
|
echo "Error while determining current commit" >&2
|
||||||
@ -83,7 +80,7 @@ fi
|
|||||||
source_opt= # make this its own var since it contains spaces
|
source_opt= # make this its own var since it contains spaces
|
||||||
if [ $origin != vmcheck ]; then
|
if [ $origin != vmcheck ]; then
|
||||||
source_title="${origin}"
|
source_title="${origin}"
|
||||||
if [ -n "$version" ]; then
|
if [[ $version != null ]]; then
|
||||||
source_title="${source_title} (${version}; $timestamp)"
|
source_title="${source_title} (${version}; $timestamp)"
|
||||||
else
|
else
|
||||||
source_title="${source_title} ($timestamp)"
|
source_title="${source_title} ($timestamp)"
|
||||||
|
Loading…
Reference in New Issue
Block a user