Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
forked frompoise/python

Commit0e10ccb

Browse files
Merge pull requestpoise#21 from opscode-cookbooks/whyrun
Adding whyrun support to python LWRP.
2 parentse7d06b4 +2a4f29d commit0e10ccb

File tree

2 files changed

+26
-14
lines changed

2 files changed

+26
-14
lines changed

‎providers/pip.rb

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
require'chef/mixin/language'
2323
includeChef::Mixin::ShellOut
2424

25+
defwhyrun_supported?
26+
true
27+
end
28+
2529
# the logic in all action methods mirror that of
2630
# the Chef::Provider::Package which will make
2731
# refactoring into core chef easy
@@ -42,10 +46,10 @@
4246
end
4347

4448
ifinstall_version
45-
Chef::Log.info("Installing#{@new_resource} version#{install_version}")
46-
status=install_package(@new_resource.package_name,install_version,timeout)
47-
ifstatus
48-
@new_resource.updated_by_last_action(true)
49+
description="install package#{@new_resource} version#{install_version}"
50+
converge_by(description)do
51+
Chef::Log.info("Installing#{@new_resource} version#{install_version}")
52+
status=install_package(@new_resource.package_name,install_version,timeout)
4953
end
5054
end
5155
end
@@ -59,10 +63,10 @@
5963

6064
if@current_resource.version !=candidate_version
6165
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-
ifstatus
65-
@new_resource.updated_by_last_action(true)
66+
description="upgrade#{@current_resource} version from#{@current_resource.version} to#{candidate_version}"
67+
converge_by(description)do
68+
Chef::Log.info("Upgrading#{@new_resource} version from#{orig_version} to#{candidate_version}")
69+
status=upgrade_package(@new_resource.package_name,candidate_version,timeout)
6670
end
6771
end
6872
end
@@ -75,9 +79,11 @@
7579
end
7680

7781
ifremoving_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)
82+
description="remove package#{@new_resource}"
83+
converge_by(description)do
84+
Chef::Log.info("Removing#{@new_resource}")
85+
remove_package(@current_resource.package_name,@new_resource.version,timeout)
86+
end
8187
else
8288
end
8389
end

‎providers/virtualenv.rb

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@
2222
require'chef/mixin/language'
2323
includeChef::Mixin::ShellOut
2424

25+
defwhyrun_supported?
26+
true
27+
end
28+
2529
action:createdo
2630
unlessexists?
2731
Chef::Log.info("Creating virtualenv#{@new_resource} at#{@new_resource.path}")
@@ -35,9 +39,11 @@
3539

3640
action:deletedo
3741
ifexists?
38-
Chef::Log.info("Deleting virtualenv#{@new_resource} at#{@new_resource.path}")
39-
FileUtils.rm_rf(@new_resource.path)
40-
new_resource.updated_by_last_action(true)
42+
description="delete virtualenv#{@new_resource} at#{@new_resource.path}"
43+
converge_by(description)do
44+
Chef::Log.info("Deleting virtualenv#{@new_resource} at#{@new_resource.path}")
45+
FileUtils.rm_rf(@new_resource.path)
46+
end
4147
end
4248
end
4349

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp