Merge pull request 'remove secretsUploadDirectory from common module' (#2509) from lassulus/clan-core:no-secrets-upload-dir into main
This commit is contained in:
@@ -178,10 +178,6 @@ class Machine:
|
||||
def secrets_upload_directory(self) -> str:
|
||||
return self.deployment["facts"]["secretUploadDirectory"]
|
||||
|
||||
@property
|
||||
def secret_vars_upload_directory(self) -> str:
|
||||
return self.deployment["vars"]["secretUploadDirectory"]
|
||||
|
||||
@property
|
||||
def flake_dir(self) -> Path:
|
||||
if self.flake.is_local():
|
||||
|
||||
@@ -136,7 +136,10 @@ class SecretStore(SecretStoreBase):
|
||||
local_hash = self.generate_hash()
|
||||
remote_hash = self.machine.target_host.run(
|
||||
# TODO get the path to the secrets from the machine
|
||||
["cat", f"{self.machine.secret_vars_upload_directory}/.pass_info"],
|
||||
[
|
||||
"cat",
|
||||
f"{self.machine.deployment["password-store"]["secretLocation"]}/.pass_info",
|
||||
],
|
||||
log=Log.STDERR,
|
||||
check=False,
|
||||
).stdout.strip()
|
||||
|
||||
@@ -5,6 +5,7 @@ from pathlib import Path
|
||||
from tempfile import TemporaryDirectory
|
||||
|
||||
from clan_cli.completions import add_dynamic_completer, complete_machines
|
||||
from clan_cli.errors import ClanError
|
||||
from clan_cli.machines.machines import Machine
|
||||
from clan_cli.ssh.upload import upload
|
||||
|
||||
@@ -21,9 +22,14 @@ def upload_secret_vars(machine: Machine) -> None:
|
||||
with TemporaryDirectory(prefix="vars-upload-") as tempdir:
|
||||
secret_dir = Path(tempdir)
|
||||
secret_store.upload(secret_dir)
|
||||
upload(
|
||||
machine.target_host, secret_dir, Path(machine.secret_vars_upload_directory)
|
||||
)
|
||||
if secret_store.store_name == "password-store":
|
||||
upload_dir = Path(machine.deployment["password-store"]["secretLocation"])
|
||||
upload(machine.target_host, secret_dir, upload_dir)
|
||||
elif secret_store.store_name == "sops":
|
||||
pass
|
||||
else:
|
||||
msg = "upload function used on unsuitable secret_store"
|
||||
raise ClanError(msg)
|
||||
|
||||
|
||||
def upload_command(args: argparse.Namespace) -> None:
|
||||
|
||||
Reference in New Issue
Block a user