class Chef::Knife::EncryptedAttributeDelete

knife encrypted attribute delete command.

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

Public Instance Methods

run() click to toggle source

Runs knife command.

@return void @raise [ArgumentError] if the attribute path format is wrong. @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_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