ocid: add config subcommand
This subcommand is so that users can get a nice commented version of the ocid configuration file. This comes from the "current" version of the configuration (allowing somone to get their custom configuration as a file). It also has a --default option. In addition, update the tests to use `ocid config` so that we test this setup (the loading and saving of the options). Signed-off-by: Aleksa Sarai <asarai@suse.de>
This commit is contained in:
parent
cd9e7de108
commit
9fb23bf0dc
3 changed files with 118 additions and 31 deletions
|
@ -23,6 +23,7 @@ RUNC_BINARY=${RUNC_PATH:-/usr/local/sbin/runc}
|
|||
|
||||
TESTDIR=$(mktemp -d)
|
||||
OCID_SOCKET="$TESTDIR/ocid.sock"
|
||||
OCID_CONFIG="$TESTDIR/ocid.conf"
|
||||
|
||||
cp "$CONMON_BINARY" "$TESTDIR/conmon"
|
||||
|
||||
|
@ -72,7 +73,8 @@ function wait_until_reachable() {
|
|||
|
||||
# Start ocid.
|
||||
function start_ocid() {
|
||||
"$OCID_BINARY" --conmon "$CONMON_BINARY" --pause "$PAUSE_BINARY" --debug --listen "$TESTDIR/ocid.sock" --runtime "$RUNC_BINARY" --root "$TESTDIR/ocid" --sandboxdir "$TESTDIR/sandboxes" --containerdir "$TESTDIR/ocid/containers" & OCID_PID=$!
|
||||
"$OCID_BINARY" --conmon "$CONMON_BINARY" --pause "$PAUSE_BINARY" --listen "$OCID_SOCKET" --runtime "$RUNC_BINARY" --root "$TESTDIR/ocid" --sandboxdir "$TESTDIR/sandboxes" --containerdir "$TESTDIR/ocid/containers" config >$OCID_CONFIG
|
||||
"$OCID_BINARY" --debug --config "$OCID_CONFIG" & OCID_PID=$!
|
||||
wait_until_reachable
|
||||
}
|
||||
|
||||
|
@ -106,6 +108,7 @@ function cleanup_pods() {
|
|||
function stop_ocid() {
|
||||
if [ "$OCID_PID" != "" ]; then
|
||||
kill "$OCID_PID" >/dev/null 2>&1
|
||||
rm -f "$OCID_CONFIG"
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue