[PATCH/foreman 1/1] Added deprication warning to ssh-using-foreman

Signed-off-by: Brian Gupta <brian.gupta@brandorr.com>

··· --- extras/query/ssh_using_foreman | 5 +++++ 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/extras/query/ssh_using_foreman b/extras/query/ssh_using_foreman
index 4f4cd39…7acc0d2 100755
— a/extras/query/ssh_using_foreman
+++ b/extras/query/ssh_using_foreman
@@ -29,6 +29,9 @@ optparse = OptionParser.new do |opts|
opts.on( ‘-u’, ‘–user USER’, “User to use - defaults to #{options[:user]}” ) do |user|
options[:user] = user
end

  • opts.on( ‘-q’, ‘–quiet’, ‘Suppress deprication warning’ ) do |cmd|

  • options[:quiet] = true

  • end

    options[:facts] = {}
    opts.on( ‘-f’, ‘–facts fact=x,fact=y…’, ‘one or more facts to filter the host list’ ) do |facts|
    @@ -55,6 +58,7 @@ optparse = OptionParser.new do |opts|
    end

optparse.parse!
+puts “WARNING: The Query API is deprecated and will be retired. Please use the new Search API.” unless options[:quiet]

if options[:command].empty? or (options[:facts].empty? and options[:class].empty?)
puts optparse
@@ -66,6 +70,7 @@ unless ARGV.empty?
exit 1
end

puts "About to execute: #{options[:command]}"
query = {“state” => options[:state]}
query.merge!({“fact” => options[:facts]}) unless options[:facts].empty?

1.7.4.1