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

Commitc02b226

Browse files
Adding whyrun support to python LWRP.
1 parente7d06b4 commitc02b226

File tree

2 files changed

+30
-14
lines changed

2 files changed

+30
-14
lines changed

‎providers/pip.rb

Lines changed: 20 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,11 @@
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=[]
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)
4954
end
5055
end
5156
end
@@ -59,10 +64,11 @@
5964

6065
if@current_resource.version !=candidate_version
6166
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)
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)
6672
end
6773
end
6874
end
@@ -75,9 +81,12 @@
7581
end
7682

7783
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)
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
8190
else
8291
end
8392
end

‎providers/virtualenv.rb

Lines changed: 10 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,12 @@
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=[]
43+
description <<"delete virtualenv#{@new_resource} at#{@new_resource.path}"
44+
converge_by(description)do
45+
Chef::Log.info("Deleting virtualenv#{@new_resource} at#{@new_resource.path}")
46+
FileUtils.rm_rf(@new_resource.path)
47+
end
4148
end
4249
end
4350

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp