Class: OpscodeAcl::GroupDestroy

Inherits:
Chef::Knife
  • Object
show all
Defined in:
lib/chef/knife/group_destroy.rb

Instance Method Summary collapse

Instance Method Details

#runObject



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

def run
  group_name = name_args[0]

  if name_args.length != 1
    show_usage
    ui.fatal "You must specify group name"
    exit 1
  end

  validate_member_name!(group_name)

  if %w{admins billing-admins clients users}.include?(group_name.downcase)
    ui.fatal "the '#{group_name}' group is a special group that should not be destroyed"
    exit 1
  end
  ui.msg "Destroying '#{group_name}' group"
  rest.delete_rest("groups/#{group_name}")
end