docstring/spcd/init

This commit is contained in:
Marc Beninca 2024-08-19 17:50:34 +02:00
parent b41478a747
commit ba59b1618f
Signed by: marc.beninca
GPG key ID: 9C7613450C80C24F

View file

@ -19,6 +19,7 @@ COMMANDS_PREFIX = "spcd-"
def clone_project_branch() -> None: def clone_project_branch() -> None:
"""Clone project on triggering branch into the current workspace."""
if not projects.environment.get("GITLAB_CI"): if not projects.environment.get("GITLAB_CI"):
step("Clone project branch") step("Clone project branch")
log.info(projects) log.info(projects)
@ -41,6 +42,7 @@ def clone_project_branch() -> None:
def install_commands(path: str) -> None: def install_commands(path: str) -> None:
"""Make commands callable in the operating system."""
step("Install commands") step("Install commands")
user = Path("/usr/local/bin") user = Path("/usr/local/bin")
for command in [ for command in [
@ -54,6 +56,7 @@ def install_commands(path: str) -> None:
def install_python_packages() -> None: def install_python_packages() -> None:
"""Upgrade pip then install extra Python packages."""
step("Install Python packages") step("Install Python packages")
log.info("pip") log.info("pip")
run("pip", "install", "--upgrade", "pip") run("pip", "install", "--upgrade", "pip")
@ -74,6 +77,7 @@ def install_python_packages() -> None:
def list_environment_variables() -> None: def list_environment_variables() -> None:
"""List accessible variables and their public contents."""
step("List environment variables") step("List environment variables")
for variable, value in sorted(projects.environment.items()): for variable, value in sorted(projects.environment.items()):
if variable not in ["SPCD", "SPCD_SSH_KEY"]: if variable not in ["SPCD", "SPCD_SSH_KEY"]:
@ -100,6 +104,7 @@ def main(main: str) -> None:
def set_ssh() -> None: def set_ssh() -> None:
"""Set things up to enable access to targets through SSH."""
step("Set SSH") step("Set SSH")
# get variables # get variables
ssh_hosts = projects.environment.get("SPCD_SSH_HOSTS") ssh_hosts = projects.environment.get("SPCD_SSH_HOSTS")