From cded07db0df92883df3f38151bc2ceb6336165c3 Mon Sep 17 00:00:00 2001 From: elijah Date: Tue, 16 Jun 2015 15:12:01 -0700 Subject: fix problem with default environment and secrets.json generation --- lib/leap_cli/commands/compile.rb | 19 +++++++++---------- lib/leap_cli/commands/deploy.rb | 2 +- 2 files changed, 10 insertions(+), 11 deletions(-) (limited to 'lib/leap_cli/commands') 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) -- cgit v1.2.3