Class: Prof::OpsManagerLogFetcher
- Inherits:
-
Object
- Object
- Prof::OpsManagerLogFetcher
- Defined in:
- lib/prof/ops_manager_log_fetcher.rb
Instance Method Summary collapse
- #fetch_logs(log_name, lines_from_tail = 0) ⇒ Object
-
#initialize(ssh_gateway:, host:, username:, password:) ⇒ OpsManagerLogFetcher
constructor
A new instance of OpsManagerLogFetcher.
Constructor Details
#initialize(ssh_gateway:, host:, username:, password:) ⇒ OpsManagerLogFetcher
Returns a new instance of OpsManagerLogFetcher.
13 14 15 16 17 18 |
# File 'lib/prof/ops_manager_log_fetcher.rb', line 13 def initialize(ssh_gateway:, host:, username:, password:) @ssh_gateway = ssh_gateway @host = host @username = username @password = password end |
Instance Method Details
#fetch_logs(log_name, lines_from_tail = 0) ⇒ Object
20 21 22 23 24 |
# File 'lib/prof/ops_manager_log_fetcher.rb', line 20 def fetch_logs(log_name, lines_from_tail = 0) read_command = lines_from_tail > 0 ? "tail -n #{lines_from_tail}" : 'cat' command = "#{read_command} /tmp/logs/#{log_name}" ssh_gateway.execute_on(host, command, user: username, password: password) end |