aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorelijah <elijah@riseup.net>2014-06-04 14:54:19 -0700
committerelijah <elijah@riseup.net>2014-06-04 14:54:19 -0700
commit2c03995839437729bf48332124a7a30c112dba18 (patch)
tree8cce19a32d573a35c0df2683a728e691861c2293 /lib
parentdde0c4c9b9444107ac2c991c4c43155d50bc99c0 (diff)
downloadleap_cli-2c03995839437729bf48332124a7a30c112dba18.tar.gz
leap_cli-2c03995839437729bf48332124a7a30c112dba18.tar.bz2
by default, skip local nodes on `leap facts update`
Diffstat (limited to 'lib')
-rw-r--r--lib/leap_cli/commands/facts.rb2
-rw-r--r--lib/leap_cli/config/manager.rb11
2 files changed, 10 insertions, 3 deletions
diff --git a/lib/leap_cli/commands/facts.rb b/lib/leap_cli/commands/facts.rb
index 43a04df..d607086 100644
--- a/lib/leap_cli/commands/facts.rb
+++ b/lib/leap_cli/commands/facts.rb
@@ -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|
diff --git a/lib/leap_cli/config/manager.rb b/lib/leap_cli/config/manager.rb
index 1a66bff..00d2f97 100644
--- a/lib/leap_cli/config/manager.rb
+++ b/lib/leap_cli/config/manager.rb
@@ -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