Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update secret .to to sync files to all nodes #1698

Merged
merged 1 commit into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,9 @@ def to(
self.rename(name)
return self
self.write(path=path, env=process)
if path and len(system.ips) > 1:
for node in system.ips[1:]:
system._local_rsync(src=path, dest=Path(path).parent, node=node)
new_secret = copy.deepcopy(self)
new_secret._values = None
new_secret.path = path
Expand All @@ -186,7 +189,9 @@ def to(
new_secret.path = self._file_to(
key=key, system=system, path=path, values=self.values
)

if len(system.ips) > 1:
for node in system.ips[1:]:
system._local_rsync(source=path, dest=Path(path).parent, node=node)
if process or self.env_vars:
env_vars = self.env_vars or self._DEFAULT_ENV_VARS
if env_vars:
Expand Down
10 changes: 10 additions & 0 deletions tests/test_resources/test_clusters/test_multinode_cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,3 +144,13 @@ def test_run_bash_on_node(self, cluster):
result = cluster.run_bash("echo 'Hello World!'", process=process)
assert result[0] == 0
assert result[1] == "Hello World!\n"

@pytest.mark.level("release")
def test_multinode_secrets_to(self, cluster):
custom_provider_secret = rh.provider_secret(
provider="custom", values={"secret": "value"}
)
custom_provider_secret.to(cluster, path="~/.custom/secret.json")
for node in cluster.ips:
result = cluster.run_bash("ls ~/.custom", node=node)
assert "secret.json" in result[1]
Loading