Class: Prepp::Target

Inherits:
Struct show all
Defined in:
lib/prepp/target.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#hostObject

Returns the value of attribute host

Returns:

  • (Object)

    the current value of host



4
5
6
# File 'lib/prepp/target.rb', line 4

def host
  @host
end

#optionsObject

Returns the value of attribute options

Returns:

  • (Object)

    the current value of options



4
5
6
# File 'lib/prepp/target.rb', line 4

def options
  @options
end

#userObject

Returns the value of attribute user

Returns:

  • (Object)

    the current value of user



4
5
6
# File 'lib/prepp/target.rb', line 4

def user
  @user
end

Instance Method Details

#connectionObject



5
6
7
# File 'lib/prepp/target.rb', line 5

def connection
  @connection ||= Net::SSH.start(host, user, options)
end

#execute(commands) ⇒ Object



9
10
11
12
13
# File 'lib/prepp/target.rb', line 9

def execute(commands)
  commands.each do |cmd|
    cmd.results << connection.exec!(cmd.to_s)
  end
end