Skip to content
This repository has been archived by the owner on Jan 4, 2021. It is now read-only.

choria::discover at_least => 0 results in err #590

Closed
khaefeli opened this issue Jun 7, 2019 · 2 comments
Closed

choria::discover at_least => 0 results in err #590

khaefeli opened this issue Jun 7, 2019 · 2 comments

Comments

@khaefeli
Copy link

khaefeli commented Jun 7, 2019

I've the following code to discover new nodes, where I don't know the $fqdn yet:

$range = range(0,19)
 $range.each | $x | {
   $result = choria::discover('mcollective',
     at_least => 0,
     discovery_method => mc,
     #test => true,
     facts => ["fqdn=/${node}.*/"],
   )
   if $result.empty { notice("no result") }
   else { notice("test 123") }
 }

this results in Error: Evaluation Error: Error while evaluating a Function Call, Did not discover any nodes for nodeset task_nodes if discover doesn't find any node and stops the execution of the plan.

expected output: empty $result and exit code 0

@ripienaar ripienaar transferred this issue from choria-io/puppet-choria Jun 7, 2019
ripienaar added a commit to ripienaar/mcollective-choria that referenced this issue Jun 7, 2019
This allows 0 results to not fail as is currently the behaviour
while maintaining backwards compat
@ripienaar
Copy link
Collaborator

@khaefeli are you in a position to test the small patch in the associated PR?

It ads a new property empty_ok to all discovery types that avoid the error from being raised when set to true

@khaefeli
Copy link
Author

khaefeli commented Jun 9, 2019

@ripienaar works like a charm. Thank you!

ripienaar added a commit that referenced this issue Jun 11, 2019
(#590) add a nodeset property empty_ok
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants