Class: Chef::Knife::EncryptedAttributeDelete

Inherits:
Core::EncryptedAttributeBase show all
Includes:
Core::EncryptedAttributeDepends
Defined in:
lib/chef/knife/encrypted_attribute_delete.rb

Overview

knife encrypted attribute delete command.

$ knife encrypted attribute delete NODE ATTRIBUTE (options)

Instance Method Summary collapse

Methods included from Core::EncryptedAttributeDepends

included

Methods inherited from Core::EncryptedAttributeBase

#assert_attribute_does_not_exist, #assert_attribute_exists, #assert_attribute_readable, #assert_valid_args, #attribute_path_to_ary, #attribute_path_to_ary_read_escape, #die, #option_assert, #parse_args

Instance Method Details

#runObject

Runs knife command.

Returns:

  • void

Raises:

  • (ArgumentError)

    if the attribute path format is wrong.

  • (SearchFailure)

    if there is a Chef search error.

  • (SearchFatalError)

    if the Chef search response is wrong.

  • (InvalidSearchKeys)

    if search keys structure is wrong.



50
51
52
53
54
55
56
57
58
59
60
# File 'lib/chef/knife/encrypted_attribute_delete.rb', line 50

def run
  parse_args

  return unless
    Chef::EncryptedAttribute.exist_on_node?(@node_name, @attr_ary)
  # TODO: move this to lib/EncryptedAttribute
  assert_attribute_readable(@node_name, @attr_ary) unless config[:force]
  remote_node = Chef::EncryptedAttribute::RemoteNode.new(@node_name)
  return unless remote_node.delete_attribute(@attr_ary)
  ui.info('Encrypted attribute deleted.')
end