Class: Arver::Host
Instance Attribute Summary collapse
#post_close, #post_open, #pre_close, #pre_open
#name, #parent
Instance Method Summary
collapse
#script_hooks_from_hash, #script_hooks_to_yaml
#==, #add_child, #child, #children, #each_node, #each_partition, #find, #has_child?, #has_parent?, #path, #target?, #to_ascii
Constructor Details
#initialize(name, hostgroup) ⇒ Host
Returns a new instance of Host.
10
11
12
13
|
# File 'lib/arver/host.rb', line 10
def initialize( name, hostgroup )
self.name = name
self.parent = hostgroup
end
|
Instance Attribute Details
#address ⇒ Object
23
24
25
26
|
# File 'lib/arver/host.rb', line 23
def address
return @address unless @address.nil?
self.name
end
|
#boot_address ⇒ Object
28
29
30
31
|
# File 'lib/arver/host.rb', line 28
def boot_address
return @boot_address unless @boot_address.nil?
address
end
|
#port ⇒ Object
Returns the value of attribute port.
4
5
6
|
# File 'lib/arver/host.rb', line 4
def port
@port
end
|
#username ⇒ Object
Returns the value of attribute username.
4
5
6
|
# File 'lib/arver/host.rb', line 4
def username
@username
end
|
Instance Method Details
#add_partition(partition) ⇒ Object
15
16
17
|
# File 'lib/arver/host.rb', line 15
def add_partition(partition)
add_child(partition)
end
|
#from_hash(hash) ⇒ Object
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
# File 'lib/arver/host.rb', line 59
def from_hash( hash )
script_hooks_from_hash( hash )
hash.each do | name, data |
if( name == "port" )
self.port = data
next
end
if( name == "address" )
self.address = data
next
end
if( name == "boot_address" )
self.boot_address = data
next
end
if( name == "username" )
self.username= data
next
end
p = Arver::Partition.new( name, self )
p.from_hash( data )
end
end
|
#partition(name) ⇒ Object
19
20
21
|
# File 'lib/arver/host.rb', line 19
def partition(name)
child(name)
end
|
#run_action(action) ⇒ Object
84
85
86
87
88
|
# File 'lib/arver/host.rb', line 84
def run_action( action )
action.pre_host( self )
super
action.post_host( self )
end
|
#to_yaml ⇒ Object
49
50
51
52
53
54
55
56
57
|
# File 'lib/arver/host.rb', line 49
def to_yaml
yaml = ""
yaml += "'address': '"+@address+"'\n" unless @address.nil?
yaml += "'boot_address': '"+@boot_address+"'\n" unless @boot_address.nil?
yaml += "'port': '"+@port+"'\n" unless @port.nil?
yaml += "'username': '"+@username+"'\n" unless @username.nil?
yaml += script_hooks_to_yaml
yaml += super
end
|