Class: Ridley::Client

Inherits:
Object
  • Object
show all
Includes:
Resource
Defined in:
lib/ridley/resources/client.rb

Overview

Author:

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Resource

#<=>, #==, #attribute, #attribute=, #attribute?, #attributes=, #chef_id, #eql?, #from_hash, #from_json, #hash, #initialize, #reload, #save, #to_hash, #to_json, #to_s

Class Method Details

.regenerate_key(connection, client) ⇒ Ridley::Client

Retrieves a client from the remote connection matching the given chef_id and regenerates it’s private key. An instance of the updated object will be returned and have a value set for the ‘private_key’ accessor.

Parameters:

Returns:

Raises:



19
20
21
22
23
# File 'lib/ridley/resources/client.rb', line 19

def regenerate_key(connection, client)
  obj = find!(connection, client)
  obj.regenerate_key
  obj
end

Instance Method Details

#attributesObject



45
46
47
48
49
# File 'lib/ridley/resources/client.rb', line 45

def attributes
  # @todo JW: reflect on the connection type to determine if we need to strip the
  # json_class attribute. Only OHC/OPC needs this stripped.
  super.except(:json_class)
end

#regenerate_keyBoolean

Regenerates the private key of the instantiated client object. The new private key will be set to the value of the ‘private_key’ accessor of the instantiated client object.

Returns:

  • (Boolean)

    true for success and false for failure



57
58
59
60
# File 'lib/ridley/resources/client.rb', line 57

def regenerate_key
  self.private_key = true
  self.save
end