Class: Chef::Knife::RoleRunListClear

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

Instance Method Summary collapse

Instance Method Details

#clear_env_run_list(role, environment) ⇒ Object



32
33
34
35
# File 'lib/chef/knife/role_run_list_clear.rb', line 32

def clear_env_run_list(role, environment)
  nlist = []
  role.env_run_lists_add(environment => nlist)
end

#runObject



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/chef/knife/role_run_list_clear.rb', line 37

def run
  if @name_args.size > 2
    ui.fatal "You must not supply an environment run list."
    show_usage
    exit 1
  end
  role = Chef::Role.load(@name_args[0])
  role.name(@name_args[0])
  environment = "_default"

  clear_env_run_list(role, environment)
  role.save
  config[:env_run_list] = true
  output(format_for_display(role))
end