Class: Racf::Commands::Search

Inherits:
AbstractCommand show all
Defined in:
lib/racf/commands/search.rb

Instance Method Summary collapse

Methods inherited from AbstractCommand

#initialize

Constructor Details

This class inherits a constructor from Racf::Commands::AbstractCommand

Instance Method Details

#extract_resources(arguments) ⇒ Object



26
27
28
# File 'lib/racf/commands/search.rb', line 26

def extract_resources(arguments)
  []
end

#run(*args) ⇒ Object

ATENTION: That method deals only with the SEARCH CLASS(TIMS) and SEARCH CLASS(GIMS) queries



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/racf/commands/search.rb', line 9

def run(*args)
  begin
    command = "SEARCH #{args.first}"
    response = @session.run_command(command)

    profiles = []
    response.each_line.each do |line|
      profiles << line.strip
    end

    return profiles
  rescue StandardError => e
    error_traces = "\t" + e.message + "\n\t" + e.backtrace.join("\n\t")
    Racf.logger.info("Ooops, an exception was raised!\n#{error_traces}")
  end
end