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

fix(jans-pycloudlib): avoid overwritten data by using merge strategy for AWS wrappers #3832

Merged
merged 1 commit into from
Feb 10, 2023
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
13 changes: 9 additions & 4 deletions jans-pycloudlib/jans/pycloudlib/config/aws_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -178,12 +178,17 @@ def set_all(self, data: dict[str, _t.Any]) -> bool:
"""
self._prepare_secret()

# fetch existing data (if any) as we will merge them;
# note that existing value will be overwritten
payload = self.get_all()

for k, v in data.items():
# ensure value that has bytes is converted to text
payload[k] = safe_value(v)

resp = self.client.update_secret(
SecretId=self.basepath,
SecretString=_dump_value(
# ensure key-value that has bytes is converted to text
{k: safe_value(v) for k, v in data.items()}
),
SecretString=_dump_value(payload),
)
return bool(resp)

Expand Down
13 changes: 9 additions & 4 deletions jans-pycloudlib/jans/pycloudlib/secret/aws_secret.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,12 +179,17 @@ def set_all(self, data: dict[str, _t.Any]) -> bool:
"""
self._prepare_secret()

# fetch existing data (if any) as we will merge them;
# note that existing value will be overwritten
payload = self.get_all()

for k, v in data.items():
# ensure value that has bytes is converted to text
payload[k] = safe_value(v)

resp = self.client.update_secret(
SecretId=self.basepath,
SecretBinary=_dump_value(
# ensure key-value that has bytes is converted to text
{k: safe_value(v) for k, v in data.items()}
),
SecretBinary=_dump_value(payload),
)
return bool(resp)

Expand Down