aboutsummaryrefslogtreecommitdiff
path: root/lib/leap_cli/config/secrets.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/leap_cli/config/secrets.rb')
-rw-r--r--lib/leap_cli/config/secrets.rb20
1 files changed, 15 insertions, 5 deletions
diff --git a/lib/leap_cli/config/secrets.rb b/lib/leap_cli/config/secrets.rb
index 00d0cd6..491870d 100644
--- a/lib/leap_cli/config/secrets.rb
+++ b/lib/leap_cli/config/secrets.rb
@@ -20,13 +20,23 @@ module LeapCli; module Config
self[key] ||= value
end
- def dump_json
- self.each_key do |key|
- unless @discovered_keys[key]
- self.delete(key)
+ #
+ # if only_discovered_keys is true, then we will only export
+ # those secrets that have been discovered and the prior ones will be cleaned out.
+ #
+ # this should only be triggered when all nodes have been processed, otherwise
+ # secrets that are actually in use will get mistakenly removed.
+ #
+ #
+ def dump_json(only_discovered_keys=false)
+ if only_discovered_keys
+ self.each_key do |key|
+ unless @discovered_keys[key]
+ self.delete(key)
+ end
end
end
- super
+ super()
end
end