class Chef::Knife::RoleEnvRunListReplace
Public Instance Methods
replace_in_env_run_list(role, environment, old_entry, new_entry)
click to toggle source
# File lib/chef/knife/role_env_run_list_replace.rb, line 32 def replace_in_env_run_list(role, environment, old_entry, new_entry) nlist = [] role.run_list_for(environment).each do |entry| if entry == old_entry nlist << new_entry else nlist << entry end end role.env_run_lists_add(environment => nlist) end
run()
click to toggle source
# File lib/chef/knife/role_env_run_list_replace.rb, line 44 def run role = Chef::Role.load(@name_args[0]) role.name(@name_args[0]) environment = @name_args[1] old_entry = @name_args[2] new_entry = @name_args[3] replace_in_env_run_list(role, environment, old_entry, new_entry) role.save config[:env_run_list] = true output(format_for_display(role)) end