class Chef::Knife::EncryptedAttributeEdit

knife encrypted attribute edit command.

“` $ knife encrypted attribute edit 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_edit.rb, line 46
def assert_valid_args
  assert_attribute_exists(@node_name, @attr_ary)
end
run() click to toggle source

Runs knife command.

@raise [RuntimeError] if the editing command fails. @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_edit.rb, line 73
def run
  parse_args

  # edit encrypted attribute
  enc_attr =
    Chef::EncryptedAttribute.new(
      Chef::Config[:knife][:encrypted_attributes]
    )
  input = enc_attr.load_from_node(@node_name, @attr_ary)
  output = edit_data(input, config[:input_format])
  enc_attr.create_on_node(@node_name, @attr_ary, output)
end