X-Git-Url: https://review.fuel-infra.org/gitweb?a=blobdiff_plain;f=plugins%2Fmcollective%2Fapplication%2Frpc.rb;h=47d5665a123d38218daf5f3f6f0bf36a427297d8;hb=d1f1649ba43c5cbc43c4beb2380096ba051d646a;hp=c69cfd18b6fa854e6e9330932a02fd31116a8ab2;hpb=b87d2f4e68281062df1913440ca5753ae63314a9;p=packages%2Fprecise%2Fmcollective.git diff --git a/plugins/mcollective/application/rpc.rb b/plugins/mcollective/application/rpc.rb index c69cfd1..47d5665 100644 --- a/plugins/mcollective/application/rpc.rb +++ b/plugins/mcollective/application/rpc.rb @@ -84,6 +84,8 @@ class MCollective::Application::Rpc true} - - unless STDIN.tty? - discovery_data = STDIN.read.chomp - discover_args = {:json => discovery_data} unless discovery_data == "" + # IF the discovery method hasn't been explicitly overridden + # and we're not being run interactively, + # and someone has piped us some data + # Then we assume it's a discovery list - this can be either: + # - list of hosts in plaintext + # - JSON that came from another rpc or printrpc + if mc.default_discovery_method && !STDIN.tty? && !STDIN.eof? + # Then we override discovery to try to grok the data on STDIN + mc.discovery_method = 'stdin' + mc.discovery_options = 'auto' + discover_args = {:verbose => false} end mc.discover discover_args