class Chef::Knife::GroupDestroy

Public Instance Methods

run() click to toggle source
# File lib/chef/knife/group_destroy.rb, line 33
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 cannot not be destroyed"
    exit 1
  end
  ui.msg "Destroying '#{group_name}' group"
  rest.delete_rest("groups/#{group_name}")
end