Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content
This repository was archived by the owner on Oct 2, 2018. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 17 additions & 11 deletions providers/pip.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
require 'chef/mixin/language'
include Chef::Mixin::ShellOut

def whyrun_supported?
true
end

# the logic in all action methods mirror that of
# the Chef::Provider::Package which will make
# refactoring into core chef easy
Expand All @@ -42,10 +46,10 @@
end

if install_version
Chef::Log.info("Installing #{@new_resource} version #{install_version}")
status = install_package(@new_resource.package_name, install_version, timeout)
if status
@new_resource.updated_by_last_action(true)
description = "install package #{@new_resource} version #{install_version}"
converge_by(description) do
Chef::Log.info("Installing #{@new_resource} version #{install_version}")
status = install_package(@new_resource.package_name, install_version, timeout)
end
end
end
Expand All @@ -59,10 +63,10 @@

if @current_resource.version != candidate_version
orig_version = @current_resource.version || "uninstalled"
Chef::Log.info("Upgrading #{@new_resource} version from #{orig_version} to #{candidate_version}")
status = upgrade_package(@new_resource.package_name, candidate_version, timeout)
if status
@new_resource.updated_by_last_action(true)
description = "upgrade #{@current_resource} version from #{@current_resource.version} to #{candidate_version}"
converge_by(description) do
Chef::Log.info("Upgrading #{@new_resource} version from #{orig_version} to #{candidate_version}")
status = upgrade_package(@new_resource.package_name, candidate_version, timeout)
end
end
end
Expand All @@ -75,9 +79,11 @@
end

if removing_package?
Chef::Log.info("Removing #{@new_resource}")
remove_package(@current_resource.package_name, @new_resource.version, timeout)
@new_resource.updated_by_last_action(true)
description = "remove package #{@new_resource}"
converge_by(description) do
Chef::Log.info("Removing #{@new_resource}")
remove_package(@current_resource.package_name, @new_resource.version, timeout)
end
else
end
end
Expand Down
12 changes: 9 additions & 3 deletions providers/virtualenv.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@
require 'chef/mixin/language'
include Chef::Mixin::ShellOut

def whyrun_supported?
true
end

action :create do
unless exists?
Chef::Log.info("Creating virtualenv #{@new_resource} at #{@new_resource.path}")
Expand All @@ -35,9 +39,11 @@

action :delete do
if exists?
Chef::Log.info("Deleting virtualenv #{@new_resource} at #{@new_resource.path}")
FileUtils.rm_rf(@new_resource.path)
new_resource.updated_by_last_action(true)
description = "delete virtualenv #{@new_resource} at #{@new_resource.path}"
converge_by(description) do
Chef::Log.info("Deleting virtualenv #{@new_resource} at #{@new_resource.path}")
FileUtils.rm_rf(@new_resource.path)
end
end
end

Expand Down