Class: Chake::Node
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#hostname ⇒ Object
readonly
Returns the value of attribute hostname.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#remote_username ⇒ Object
readonly
Returns the value of attribute remote_username.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Class Method Summary collapse
Instance Method Summary collapse
- #backend ⇒ Object
-
#initialize(hostname, data = {}) ⇒ Node
constructor
A new instance of Node.
Constructor Details
#initialize(hostname, data = {}) ⇒ Node
Returns a new instance of Node.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/chake/node.rb', line 27 def initialize(hostname, data = {}) uri = URI.parse(hostname) if !uri.host && ((!uri.scheme && uri.path) || (uri.scheme && uri.opaque)) uri = URI.parse("ssh://#{hostname}") end if uri.path && uri.path.empty? uri.path = nil end @backend_name = uri.scheme @hostname = uri.host @port = uri.port @username = uri.user || Etc.getpwuid.name @remote_username = uri.user @path = uri.path || "/var/tmp/chef.#{username}" @data = data if @hostname.length > self.class.max_node_name_length self.class.max_node_name_length = @hostname.length end end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
18 19 20 |
# File 'lib/chake/node.rb', line 18 def data @data end |
#hostname ⇒ Object (readonly)
Returns the value of attribute hostname.
13 14 15 |
# File 'lib/chake/node.rb', line 13 def hostname @hostname end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
17 18 19 |
# File 'lib/chake/node.rb', line 17 def path @path end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
14 15 16 |
# File 'lib/chake/node.rb', line 14 def port @port end |
#remote_username ⇒ Object (readonly)
Returns the value of attribute remote_username.
16 17 18 |
# File 'lib/chake/node.rb', line 16 def remote_username @remote_username end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
15 16 17 |
# File 'lib/chake/node.rb', line 15 def username @username end |
Class Method Details
.max_node_name_length ⇒ Object
20 21 22 |
# File 'lib/chake/node.rb', line 20 def self.max_node_name_length @max_node_name_length ||= 0 end |
.max_node_name_length=(value) ⇒ Object
23 24 25 |
# File 'lib/chake/node.rb', line 23 def self.max_node_name_length=(value) @max_node_name_length = value end |