class Chef::Knife::PinningsWipe
This class implements knife pinnings wipe ['environment'] ['cookbook_regex']
Public Instance Methods
run()
click to toggle source
# File lib/chef/knife/pinnings_wipe.rb, line 22 def run if name_args.length < 1 ui.fatal('You must specify an environment to wipe (and optionally a cookbook regex)') exit 255 end cookbook_regex = name_args[1] || '.*' environment = Environment.load(name_args[0]) display_environments([environment], cookbook_regex) ui.msg('') ui.confirm("Do you want to wipe cookbook constraints in #{environment.name}") ui.msg('') wipe(environment, cookbook_regex) end
wipe(environment, cookbook_regex)
click to toggle source
# File lib/chef/knife/pinnings_wipe.rb, line 37 def wipe(environment, cookbook_regex) environment.cookbook_versions.delete_if do |name, _| name =~ /#{cookbook_regex}/ end environment.save ui.msg("Cookbook constraints wiped from #{environment.name}") end