Class: Chef::Knife::VaultRotateKeys

Inherits:
Chef::Knife show all
Includes:
VaultBase
Defined in:
lib/chef/knife/vault_rotate_keys.rb

Direct Known Subclasses

EncryptRotateKeys

Instance Method Summary collapse

Methods included from VaultBase

included, #show_usage

Instance Method Details

#runObject



29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/chef/knife/vault_rotate_keys.rb', line 29

def run
  vault = @name_args[0]
  item = @name_args[1]
  clean_unknown_clients = config[:clean_unknown_clients]

  if vault && item
    set_mode(config[:vault_mode])

    begin
      item = ChefVault::Item.load(vault, item)
      item.rotate_keys!(clean_unknown_clients)
    rescue ChefVault::Exceptions::KeysNotFound,
           ChefVault::Exceptions::ItemNotFound
      raise ChefVault::Exceptions::ItemNotFound,
        "#{vault}/#{item} does not exist, "\
        "use 'knife vault create' to create."
    end
  else
    show_usage
  end
end