|
22 | 22 | require 'chef/mixin/language'
|
23 | 23 | include Chef::Mixin::ShellOut
|
24 | 24 |
|
| 25 | +def whyrun_supported? |
| 26 | + true |
| 27 | +end |
| 28 | + |
25 | 29 | # the logic in all action methods mirror that of
|
26 | 30 | # the Chef::Provider::Package which will make
|
27 | 31 | # refactoring into core chef easy
|
|
42 | 46 | end
|
43 | 47 |
|
44 | 48 | if install_version
|
45 |
| - Chef::Log.info("Installing #{@new_resource} version #{install_version}") |
46 |
| - status = install_package(@new_resource.package_name, install_version, timeout) |
47 |
| - if status |
48 |
| - @new_resource.updated_by_last_action(true) |
| 49 | + description = [] |
| 50 | + description << "install package #{@new_resource} version #{install_version}" |
| 51 | + converge_by(description) do |
| 52 | + Chef::Log.info("Installing #{@new_resource} version #{install_version}") |
| 53 | + status = install_package(@new_resource.package_name, install_version, timeout) |
49 | 54 | end
|
50 | 55 | end
|
51 | 56 | end
|
|
59 | 64 |
|
60 | 65 | if @current_resource.version != candidate_version
|
61 | 66 | orig_version = @current_resource.version || "uninstalled"
|
62 |
| - Chef::Log.info("Upgrading #{@new_resource} version from #{orig_version} to #{candidate_version}") |
63 |
| - status = upgrade_package(@new_resource.package_name, candidate_version, timeout) |
64 |
| - if status |
65 |
| - @new_resource.updated_by_last_action(true) |
| 67 | + description = [] |
| 68 | + description << "upgrade #{@current_resource} version from #{@current_resource.version} to #{candidate_version}" |
| 69 | + converge_by(description) do |
| 70 | + Chef::Log.info("Upgrading #{@new_resource} version from #{orig_version} to #{candidate_version}") |
| 71 | + status = upgrade_package(@new_resource.package_name, candidate_version, timeout) |
66 | 72 | end
|
67 | 73 | end
|
68 | 74 | end
|
|
75 | 81 | end
|
76 | 82 |
|
77 | 83 | if removing_package?
|
78 |
| - Chef::Log.info("Removing #{@new_resource}") |
79 |
| - remove_package(@current_resource.package_name, @new_resource.version, timeout) |
80 |
| - @new_resource.updated_by_last_action(true) |
| 84 | + description = [] |
| 85 | + description << "remove package #{@new_resource}" |
| 86 | + converge_by(description) do |
| 87 | + Chef::Log.info("Removing #{@new_resource}") |
| 88 | + remove_package(@current_resource.package_name, @new_resource.version, timeout) |
| 89 | + end |
81 | 90 | else
|
82 | 91 | end
|
83 | 92 | end
|
|
0 commit comments