Class: Chef::Knife::RoleEnvRunListRemove
- Inherits:
-
Knife
- Object
- Knife
- Chef::Knife::RoleEnvRunListRemove
- Defined in:
- lib/chef/knife/role_env_run_list_remove.rb
Instance Method Summary collapse
Instance Method Details
#remove_from_env_run_list(role, environment, item_to_remove) ⇒ Object
32 33 34 35 36 37 38 39 40 41 |
# File 'lib/chef/knife/role_env_run_list_remove.rb', line 32 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 ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/chef/knife/role_env_run_list_remove.rb', line 43 def run role = Chef::Role.load(@name_args[0]) role.name(@name_args[0]) environment = @name_args[1] item_to_remove = @name_args[2] remove_from_env_run_list(role, environment, item_to_remove) role.save config[:env_run_list] = true output(format_for_display(role)) end |