Class: Ridley::NodeObject
- Inherits:
- 
      ChefObject
      
        - Object
- ChefObject
- Ridley::NodeObject
 
- Defined in:
- lib/ridley/chef_objects/node_object.rb
Instance Method Summary collapse
- 
  
    
      #chef_run  ⇒ HostConnector::Response 
    
    
  
  
  
  
  
  
  
  
  
    Executes a Chef run on the node. 
- 
  
    
      #cloud?  ⇒ Boolean 
    
    
  
  
  
  
  
  
  
  
  
    Returns true if the node is identified as a cloud node. 
- 
  
    
      #cloud_provider  ⇒ nil, String 
    
    
  
  
  
  
  
  
  
  
  
    Returns the cloud provider of the instantiated node. 
- 
  
    
      #ec2?  ⇒ Boolean 
    
    
  
  
  
  
  
  
  
  
  
    Returns true if the node is identified as a cloud node using the ec2 provider. 
- 
  
    
      #eucalyptus?  ⇒ Boolean 
    
    
  
  
  
  
  
  
  
  
  
    Returns true if the node is identified as a cloud node using the eucalyptus provider. 
- 
  
    
      #merge_data(options = {})  ⇒ Ridley::NodeObject 
    
    
  
  
  
  
  
  
  
  
  
    Merges the instaniated nodes data with the given data and updates the remote with the merged results. 
- 
  
    
      #public_hostname  ⇒ String 
    
    
  
  
  
  
  
  
  
  
  
    Returns the public hostname of the instantiated node. 
- 
  
    
      #public_ipv4  ⇒ String 
    
    
      (also: #public_ipaddress)
    
  
  
  
  
  
  
  
  
  
    Returns the public IPv4 address of the instantiated node. 
- 
  
    
      #put_secret  ⇒ HostConnector::Response 
    
    
  
  
  
  
  
  
  
  
  
    Puts the configured encrypted data bag secret on the node. 
- 
  
    
      #rackspace?  ⇒ Boolean 
    
    
  
  
  
  
  
  
  
  
  
    Returns true if the node is identified as a cloud node using the rackspace provider. 
- 
  
    
      #set_chef_attribute(key, value)  ⇒ Hashie::Mash 
    
    
  
  
  
  
  
  
  
  
  
    Set a node level normal attribute given the dotted path representation of the Chef attribute and value. 
Methods inherited from ChefObject
#<=>, #==, chef_id, #chef_id, chef_json_class, chef_type, #eql?, #hash, #initialize, #inspect, #reload, #save, set_chef_id, set_chef_json_class, set_chef_type, #update
Constructor Details
This class inherits a constructor from Ridley::ChefObject
Instance Method Details
#chef_run ⇒ HostConnector::Response
Executes a Chef run on the node
| 127 128 129 | # File 'lib/ridley/chef_objects/node_object.rb', line 127 def chef_run resource.chef_run(self.public_hostname) end | 
#cloud? ⇒ Boolean
Returns true if the node is identified as a cloud node.
| 99 100 101 | # File 'lib/ridley/chef_objects/node_object.rb', line 99 def cloud? self.automatic.has_key?(:cloud) end | 
#cloud_provider ⇒ nil, String
Returns the cloud provider of the instantiated node. If the node is not identified as a cloud node, then nil is returned.
| 92 93 94 | # File 'lib/ridley/chef_objects/node_object.rb', line 92 def cloud_provider self.cloud? ? self.automatic[:cloud][:provider] : nil end | 
#ec2? ⇒ Boolean
Returns true if the node is identified as a cloud node using the ec2 provider.
| 113 114 115 | # File 'lib/ridley/chef_objects/node_object.rb', line 113 def ec2? self.cloud_provider == "ec2" end | 
#eucalyptus? ⇒ Boolean
Returns true if the node is identified as a cloud node using the eucalyptus provider.
| 106 107 108 | # File 'lib/ridley/chef_objects/node_object.rb', line 106 def eucalyptus? self.cloud_provider == "eucalyptus" end | 
#merge_data(options = {}) ⇒ Ridley::NodeObject
Merges the instaniated nodes data with the given data and updates the remote with the merged results
| 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | # File 'lib/ridley/chef_objects/node_object.rb', line 147 def merge_data( = {}) new_run_list = Array([:run_list]) new_attributes = [:attributes] unless new_run_list.empty? self.run_list = self.run_list | new_run_list end unless new_attributes.nil? self.normal = self.normal.deep_merge(new_attributes) end self end | 
#public_hostname ⇒ String
Returns the public hostname of the instantiated node. This hostname should be used for public communications to the node.
| 66 67 68 | # File 'lib/ridley/chef_objects/node_object.rb', line 66 def public_hostname self.cloud? ? self.automatic[:cloud][:public_hostname] : self.automatic[:fqdn] end | 
#public_ipv4 ⇒ String Also known as: public_ipaddress
Returns the public IPv4 address of the instantiated node. This ip address should be used for public communications to the node.
| 77 78 79 | # File 'lib/ridley/chef_objects/node_object.rb', line 77 def public_ipv4 self.cloud? ? self.automatic[:cloud][:public_ipv4] : self.automatic[:ipaddress] end | 
#put_secret ⇒ HostConnector::Response
Puts the configured encrypted data bag secret on the node
| 134 135 136 | # File 'lib/ridley/chef_objects/node_object.rb', line 134 def put_secret resource.put_secret(self.public_hostname) end | 
#rackspace? ⇒ Boolean
Returns true if the node is identified as a cloud node using the rackspace provider.
| 120 121 122 | # File 'lib/ridley/chef_objects/node_object.rb', line 120 def rackspace? self.cloud_provider == "rackspace" end | 
#set_chef_attribute(key, value) ⇒ Hashie::Mash
It is not possible to set any other attribute level on a node and have it persist after a Chef Run. This is because all other attribute levels are truncated at the start of a Chef Run.
Set a node level normal attribute given the dotted path representation of the Chef attribute and value.
| 54 55 56 57 | # File 'lib/ridley/chef_objects/node_object.rb', line 54 def set_chef_attribute(key, value) attr_hash = Hashie::Mash.from_dotted_path(key, value) self.normal = self.normal.deep_merge(attr_hash) end |