]> gitweb.fluxo.info Git - leap/leap_cli.git/commitdiff
prevent `leap compile` from destroying disabled node files.
authorelijah <elijah@riseup.net>
Mon, 27 May 2013 22:07:32 +0000 (15:07 -0700)
committerelijah <elijah@riseup.net>
Mon, 27 May 2013 22:07:32 +0000 (15:07 -0700)
lib/leap_cli/config/manager.rb

index 1f81166a6a36934296fc073098e393d505c01965..dc74b6cc3a528cc71132ac389774b53b55d00748 100644 (file)
@@ -48,12 +48,14 @@ module LeapCli
         end
 
         # remove disabled nodes
+        @disabled_nodes = Config::ObjectList.new
         unless options[:include_disabled]
           @nodes.select! do |name, node|
             if node.enabled
               true
             else
               log 2, :skipping, "disabled node #{name}."
+              @disabled_nodes[name] = node
               false
             end
           end
@@ -89,6 +91,14 @@ module LeapCli
           updated_hiera << hierapath
         end
 
+        if @disabled_nodes
+          # make disabled nodes appear as if they are still active
+          @disabled_nodes.each_node do |node|
+            updated_files << Path.named_path([:node_files_dir, node.name], @provider_dir)
+            updated_hiera << Path.named_path([:hiera, node.name], @provider_dir)
+          end
+        end
+
         # remove files that are no longer needed
         if existing_hiera
           (existing_hiera - updated_hiera).each do |filepath|