aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/leap_cli/config/secrets.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/leap_cli/config/secrets.rb b/lib/leap_cli/config/secrets.rb
index 45a57e1..08e980b 100644
--- a/lib/leap_cli/config/secrets.rb
+++ b/lib/leap_cli/config/secrets.rb
@@ -32,10 +32,13 @@ module LeapCli; module Config
if only_discovered_keys
self.each_key do |environment|
self[environment].each_key do |key|
- unless @discovered_keys[environment][key]
+ unless @discovered_keys[environment] && @discovered_keys[environment][key]
self[environment].delete(key)
end
end
+ if self[environment].empty?
+ self.delete(environment)
+ end
end
end
super()