class Chef::Knife::RoleRunListRemove

Public Instance Methods

remove_from_env_run_list(role, environment, item_to_remove) click to toggle source
# File lib/chef/knife/role_run_list_remove.rb, line 31
def remove_from_env_run_list(role, environment, item_to_remove)
  nlist = []
  role.run_list_for(environment).each do |entry|
    nlist << entry unless entry == item_to_remove
    # unless entry == @name_args[2]
    #  nlist << entry
    # end
  end
  role.env_run_lists_add(environment => nlist)
end
run() click to toggle source
# File lib/chef/knife/role_run_list_remove.rb, line 42
def run
  role = Chef::Role.load(@name_args[0])
  role.name(@name_args[0])
  environment = "_default"
  item_to_remove = @name_args[1]

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