Merge bootstack-ops:keep-all-yaml-keys into bootstack-ops:master

Proposed by Joe Guo
Status: Merged
Approved by: Xav Paice
Approved revision: 8a14451fe74b78c62f43eca3abc5eef045ff33eb
Merged at revision: 178529428ba4ef09d1310ea8ddd4372344d562af
Proposed branch: bootstack-ops:keep-all-yaml-keys
Merge into: bootstack-ops:master
Diff against target: 21 lines (+3/-2)
1 file modified
bootstack-ops/juju_bundle_export.py (+3/-2)
Reviewer Review Type Date Requested Status
Xav Paice (community) Approve
Review via email: mp+384080@code.launchpad.net

Commit message

juju_bundle_export.py: keep secret option keys and mask values as '[REDACTED]'

Currently while sanitizing juju bundles with this script, secret options
like `ssl_ca` will be totally absent from the output, including keys.

This patch changes the behavior that it will keep any option keys, but
mask secret option values as "[REDACTED]".

RT: #125919

To post a comment you must log in.
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

Revision history for this message
Xav Paice (xavpaice) wrote :

+1 from me

review: Approve
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Change successfully merged at revision 178529428ba4ef09d1310ea8ddd4372344d562af

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/bootstack-ops/juju_bundle_export.py b/bootstack-ops/juju_bundle_export.py
2index 8f1845d..8e6ffae 100755
3--- a/bootstack-ops/juju_bundle_export.py
4+++ b/bootstack-ops/juju_bundle_export.py
5@@ -61,13 +61,14 @@ class Bundle(object):
6 if param in ['options']: # This might want extracting
7 for option in param_value.keys():
8 option_value = param_value[option]
9+ if 'options' not in app_data.keys():
10+ app_data['options'] = {}
11 if self.secret_regex.match(option):
12 if 'options' not in secret_data.keys():
13 secret_data['options'] = {}
14 secret_data['options'][option] = option_value
15+ app_data['options'][option] = '[REDACTED]'
16 else:
17- if 'options' not in app_data.keys():
18- app_data['options'] = {}
19 app_data['options'][option] = option_value
20 else:
21 app_data[param] = param_value

Subscribers

People subscribed via source and target branches

to all changes: