Skip to content

Proof of concept to use --target within the wrapper script to allow m… - #693

Draft
ehelms wants to merge 1 commit into
theforeman:masterfrom
ehelms:anvil
Draft

Proof of concept to use --target within the wrapper script to allow m…#693
ehelms wants to merge 1 commit into
theforeman:masterfrom
ehelms:anvil

Conversation

@ehelms

@ehelms ehelms commented Jul 22, 2026

Copy link
Copy Markdown
Member

This is a proof of concept of the idea of using a wrapper script to handle multi-host management with the state management restrictions as described in #630.

The general idea is put the --target into the wrapper script and use that to dynamically set the state directory based upon the target's value.

Comment thread anvil
}

# Extract --target before obsah sees the arguments
TARGET=""

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why clear the value? If you keep it empty you can also use

export TARGET=myserver

And then keep using anvil without remembering the target the whole time.

Suggested change
TARGET=""

Comment thread anvil
Comment on lines +55 to +61
*)
ARGS+=("$1")
shift
;;
esac
done
set -- "${ARGS[@]}"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this needed? I don't think I've ever needed it. Isn't it safe to just drop that?

Suggested change
*)
ARGS+=("$1")
shift
;;
esac
done
set -- "${ARGS[@]}"
esac
done

Comment thread anvil
Comment on lines +72 to +96
OBSAH_STATE=${OBSAH_BASE}/.var/lib/anvil/server/${TARGET}
else
OBSAH_STATE=${OBSAH_BASE}/.var/lib/anvil/server
fi
ANSIBLE_LOG_PATH=${OBSAH_STATE}/anvil.log
export ANSIBLE_LOG_PATH
unset http_proxy HTTP_PROXY https_proxy HTTPS_PROXY
;;
deploy-proxy)
OBSAH_DATA=${OBSAH_BASE}/src
if [[ -n "$TARGET" ]]; then
OBSAH_STATE=${OBSAH_BASE}/.var/lib/anvil/proxy/${TARGET}
else
OBSAH_STATE=${OBSAH_BASE}/.var/lib/anvil/proxy
fi
ANSIBLE_LOG_PATH=${OBSAH_STATE}/anvil.log
export ANSIBLE_LOG_PATH
unset http_proxy HTTP_PROXY https_proxy HTTPS_PROXY
;;
deploy-dev|vms|test|smoker|custom-certs|fetch-bundle|security|sos|lock)
OBSAH_DATA=${OBSAH_BASE}/development
if [[ -n "$TARGET" ]]; then
OBSAH_STATE=${OBSAH_BASE}/.var/lib/anvil/dev/${TARGET}
else
OBSAH_STATE=${OBSAH_BASE}/.var/lib/anvil/dev

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given the repetition, perhaps define ANVIL_BASE=${OBSAH_BASE}/.var/lib/anvil and reuse that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants