def ssh_foreach(ops: setup.Operations, node_kind: str, *params: str): config = configuration.get_config() valid_node_kinds = configuration.Node.VALID_NODE_KINDS if not (node_kind == "node" or node_kind in valid_node_kinds): command.fail("usage: spire foreach {node," + ",".join(valid_node_kinds) + "} command") for node in config.nodes: if node_kind == "node" or node.kind == node_kind: ops.ssh("run command on @HOST", node, *params)
def infra_install_packages(ops: setup.Operations, config: configuration.Config) -> None: for node in config.nodes: ops.ssh("update apt repositories on @HOST", node, "apt-get", "update") ops.ssh("upgrade packages on @HOST", node, "apt-get", "upgrade", "-y") if node.kind == "supervisor": ops.ssh("install supervisor packages on @HOST", node, "apt-get", "install", "-y", "homeworld-bootstrap-registry") else: ops.ssh("install standard packages on @HOST", node, "apt-get", "install", "-y", "homeworld-services")
def infra_install_packages(ops: setup.Operations) -> None: config = configuration.get_config() for node in config.nodes: ops.ssh("update apt repositories on @HOST", node, "apt-get", "update") ops.ssh("upgrade packages on @HOST", node, "apt-get", "upgrade", "-y")
def infra_sync(ops: setup.Operations, node_name: str) -> None: node = configuration.get_config().get_node(node_name) ops.ssh("synchronize operations on @HOST", node, "sync")