class Chef::Knife::EncryptedAttributeUpdate

knife encrypted attribute update command.

“` $ knife encrypted attribute update NODE ATTRIBUTE (options) “`

Public Instance Methods

assert_valid_args() click to toggle source

(see EncryptedAttributeBase#assert_valid_args) @raise [ArgumentError] if the attribute path format is wrong.

# File lib/chef/knife/encrypted_attribute_update.rb, line 39
def assert_valid_args
  assert_attribute_exists(@node_name, @attr_ary)
end
run() click to toggle source

Runs knife command.

@return void @raise [ArgumentError] if the attribute path format or the user list is

wrong.

@raise [UnacceptableEncryptedAttributeFormat] if encrypted attribute

format is wrong or does not exist.

@raise [UnsupportedEncryptedAttributeFormat] if encrypted attribute

format is not supported or unknown.

@raise [EncryptionFailure] if there are encryption errors. @raise [MessageAuthenticationFailure] if HMAC calculation error. @raise [InvalidPublicKey] if it is not a valid RSA public key. @raise [InvalidKey] if the RSA key format is wrong. @raise [InsufficientPrivileges] if you lack enough privileges to read

the keys from the Chef Server.

@raise [ClientNotFound] if client does not exist. @raise [Net::HTTPServerException] for Chef Server HTTP errors. @raise [RequirementsFailure] if the specified encrypted attribute

version cannot be used.

@raise [SearchFailure] if there is a Chef search error. @raise [SearchFatalError] if the Chef search response is wrong. @raise [InvalidSearchKeys] if search keys structure is wrong.

# File lib/chef/knife/encrypted_attribute_update.rb, line 65
def run
  parse_args

  # update encrypted attribute
  knife_config = Chef::Config[:knife][:encrypted_attributes]
  enc_attr = Chef::EncryptedAttribute.new(knife_config)
  if enc_attr.update_on_node(@node_name, @attr_ary)
    ui.info('Encrypted attribute updated.')
  else
    ui.info('Encrypted attribute does not need updating.')
  end
end