diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/leap_cli/commands/facts.rb | 2 | ||||
-rw-r--r-- | lib/leap_cli/config/manager.rb | 11 |
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 |