Class: Gusteau::Node

Inherits:
Object
  • Object
show all
Includes:
Log
Defined in:
lib/gusteau/node.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Log

#info, #log, #log_error

Constructor Details

#initialize(node_name, node_config) ⇒ Node

Returns a new instance of Node.



9
10
11
12
13
14
15
# File 'lib/gusteau/node.rb', line 9

def initialize(node_name, node_config)
  @name   = node_name
  @config = node_config

  @server = Server.new(@config['server'])
  @dna_path = '/tmp/dna.json'
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



7
8
9
# File 'lib/gusteau/node.rb', line 7

def config
  @config
end

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/gusteau/node.rb', line 7

def name
  @name
end

#serverObject (readonly)

Returns the value of attribute server.



7
8
9
# File 'lib/gusteau/node.rb', line 7

def server
  @server
end

Instance Method Details

#apply(run_list, opts = {}) ⇒ Object



27
28
29
30
31
# File 'lib/gusteau/node.rb', line 27

def apply(run_list, opts = {})
  with_hooks do
    server.chef.run dna(run_list), opts
  end
end

#converge(opts = {}) ⇒ Object



21
22
23
24
25
# File 'lib/gusteau/node.rb', line 21

def converge(opts = {})
  with_hooks do
    server.chef.run dna, opts
  end
end

#sshObject



33
34
35
# File 'lib/gusteau/node.rb', line 33

def ssh
  server.ssh
end

#to_sObject



17
18
19
# File 'lib/gusteau/node.rb', line 17

def to_s
  "#{name} (#{@server})"
end