turn ssh arguments into environment variables
Some checks failed
/ job (push) Failing after 10m37s

This commit is contained in:
Marc Beninca 2024-07-29 10:26:07 +02:00
parent ee69c088c2
commit e99ced2a20
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F
3 changed files with 15 additions and 8 deletions

View file

@ -45,9 +45,13 @@ spcd_main() {
spcd_list_environment_variables() {
spcd_step "List environment variables"
for spcd_lev__name in $(printenv | cut -d = -f 1 | sort); do
spcd_lev__text=""
if [ "${spcd_lev__name}" != "SPCD_SSH_KEY" ]; then
spcd_lev__text=
eval "spcd_lev__text=\"\${${spcd_lev__name}}\""
echo "${spcd_lev__name}=${spcd_lev__text}"
else
echo "${spcd_lev__name}"
fi
done
}

View file

@ -44,7 +44,6 @@ def install_commands(path: str) -> None:
for command in [
"browse-workspace",
"build-project",
"clone-branch",
"list-environment",
"synchronize",
]:
@ -57,17 +56,18 @@ def main(main: str) -> None:
name = Path(path).name
if name == "__main__.py":
clone_project_branch()
set_ssh(*arguments)
set_ssh()
install_commands(main)
else:
function = getattr(cmd, name.replace("-", "_"))
function(*arguments)
def set_ssh(*arguments: list[str]) -> None:
def set_ssh() -> None:
step("Set SSH")
# get variables
ssh_key, ssh_hosts = arguments
ssh_hosts = projects.environment.get("SPCD_SSH_HOSTS")
ssh_key = projects.environment.get("SPCD_SSH_KEY")
# set key type
ssh_type = "ed25519"
# set home directory

View file

@ -25,7 +25,10 @@ def spcd_build_project() -> None:
def spcd_list_environment() -> None:
for variable, value in sorted(projects.environment.items()):
if variable != "SPCD_SSH_KEY":
log.info(f"{variable} = {value}")
else:
log.info(f"{variable}")
def spcd_synchronize() -> None: