]> gitweb.fluxo.info Git - leap/leap_cli.git/commitdiff
by default, skip local nodes on `leap facts update`
authorelijah <elijah@riseup.net>
Wed, 4 Jun 2014 21:54:19 +0000 (14:54 -0700)
committerelijah <elijah@riseup.net>
Wed, 4 Jun 2014 21:54:19 +0000 (14:54 -0700)
lib/leap_cli/commands/facts.rb
lib/leap_cli/config/manager.rb

index 43a04dfbf72705893800154e0d07f7aa96fa5577..d607086de6d94d96b3b646b86c4698d4e5167487 100644 (file)
@@ -79,7 +79,7 @@ module LeapCli; module Commands
   private
 
   def update_facts(global_options, options, args)
-    nodes = manager.filter(args)
+    nodes = manager.filter(args, :local => false)
     new_facts = {}
     ssh_connect(nodes) do |ssh|
       ssh.leap.run_with_progress(facter_cmd) do |response|
index 1a66bff236840ce8f11866d696b1e745758b40c4..00d2f972b85ccbb559f5da6242519d1b4faf3847 100644 (file)
@@ -182,9 +182,16 @@ module LeapCli
       #
       # if conditions is prefixed with +, then it works like an AND. Otherwise, it works like an OR.
       #
-      def filter(filters)
+      # options:
+      # :local -- if :local is false and the filter is empty, then local nodes are excluded.
+      #
+      def filter(filters, options={})
         if filters.empty?
-          return nodes
+          if options[:local] === false
+            return nodes[:environment => '!local']
+          else
+            return nodes
+          end
         end
         if filters[0] =~ /^\+/
           # don't let the first filter have a + prefix