summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2015-06-16 15:12:01 -0700
committerelijah <elijah@riseup.net>2015-06-16 15:12:01 -0700
commitcded07db0df92883df3f38151bc2ceb6336165c3 (patch)
tree7fe88eebf8773a096cf4ee4344bc44ce1f6a72b4
parentd3ea29bbf4ab2b23a0b5fc43ad803d882d2366b6 (diff)
fix problem with default environment and secrets.json generation
-rw-r--r--lib/leap_cli/commands/compile.rb19
-rw-r--r--lib/leap_cli/commands/deploy.rb2
-rw-r--r--lib/leap_cli/config/secrets.rb2
3 files changed, 12 insertions, 11 deletions
diff --git a/lib/leap_cli/commands/compile.rb b/lib/leap_cli/commands/compile.rb
index cfafc74..374e199 100644
--- a/lib/leap_cli/commands/compile.rb
+++ b/lib/leap_cli/commands/compile.rb
@@ -14,12 +14,13 @@ module LeapCli
end
if environment
if manager.environment_names.include?(environment)
- compile_hiera_files(manager.filter([environment]))
+ compile_hiera_files(manager.filter([environment]), false)
else
bail! "There is no environment named `#{environment}`."
end
else
- compile_hiera_files(manager.filter)
+ clean_export = LeapCli.leapfile.environment.nil?
+ compile_hiera_files(manager.filter, clean_export)
end
end
end
@@ -36,15 +37,13 @@ module LeapCli
protected
- def compile_hiera_files(nodes=nil)
- # these must come first
- update_compiled_ssh_configs
-
- # export generated files
+ #
+ # a "clean" export of secrets will also remove keys that are no longer used,
+ # but this should not be done if we are not examining all possible nodes.
+ #
+ def compile_hiera_files(nodes, clean_export)
+ update_compiled_ssh_configs # must come first
manager.export_nodes(nodes)
- # a "clean" export of secrets will also remove keys that are no longer used,
- # but this should not be done if we are not examining all possible nodes.
- clean_export = nodes.nil?
manager.export_secrets(clean_export)
end
diff --git a/lib/leap_cli/commands/deploy.rb b/lib/leap_cli/commands/deploy.rb
index 03240ce..f5c47fe 100644
--- a/lib/leap_cli/commands/deploy.rb
+++ b/lib/leap_cli/commands/deploy.rb
@@ -51,7 +51,7 @@ module LeapCli
end
# compile hiera files for all the nodes in every environment that is
# being deployed and only those environments.
- compile_hiera_files(manager.filter(environments))
+ compile_hiera_files(manager.filter(environments), false)
# update server certificates if needed
update_certificates(nodes)
diff --git a/lib/leap_cli/config/secrets.rb b/lib/leap_cli/config/secrets.rb
index 184d11d..44ade31 100644
--- a/lib/leap_cli/config/secrets.rb
+++ b/lib/leap_cli/config/secrets.rb
@@ -15,6 +15,7 @@ module LeapCli; module Config
# we can't use fetch() or get(), since those already have special meanings
def retrieve(key, environment)
+ environment ||= 'default'
self.fetch(environment, {})[key.to_s]
end
@@ -31,6 +32,7 @@ module LeapCli; module Config
end
def set_with_block(key, environment, &block)
+ environment ||= 'default'
key = key.to_s
@discovered_keys[environment] ||= {}
@discovered_keys[environment][key] = true