Class: LogListener::Start

Inherits:
Object
  • Object
show all
Defined in:
lib/log-listener/classes/start.rb

Constant Summary collapse

PATH =
'/data/public/log'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ Start

Returns a new instance of Start.



9
10
11
12
13
14
# File 'lib/log-listener/classes/start.rb', line 9

def initialize(*args)
  @host = args[0]
  @user = args[1] 
  @password = args[2]
  @result = []
end

Instance Attribute Details

#app_udp_logObject (readonly)

Returns the value of attribute app_udp_log.



4
5
6
# File 'lib/log-listener/classes/start.rb', line 4

def app_udp_log
  @app_udp_log
end

#hostObject (readonly)

Returns the value of attribute host.



4
5
6
# File 'lib/log-listener/classes/start.rb', line 4

def host
  @host
end

#passwordObject (readonly)

Returns the value of attribute password.



4
5
6
# File 'lib/log-listener/classes/start.rb', line 4

def password
  @password
end

#resultObject

Returns the value of attribute result.



4
5
6
# File 'lib/log-listener/classes/start.rb', line 4

def result
  @result
end

#userObject (readonly)

Returns the value of attribute user.



4
5
6
# File 'lib/log-listener/classes/start.rb', line 4

def user
  @user
end

Instance Method Details

#execute_this_command(actions) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/log-listener/classes/start.rb', line 20

def execute_this_command(actions)
	Net::SSH.start("#{@host}", "#{@user}", :password => "#{password}") do |ssh|
	  go_to_path = ssh.exec!("cd #{PATH}")
	  do_this = ssh.exec!("#{actions}")
    @result << do_this
  end
end

#setup_path_to_udp(path) ⇒ Object



16
17
18
# File 'lib/log-listener/classes/start.rb', line 16

def setup_path_to_udp(path)
  @app_udp_log = "#{path}" 
end