Skip to content
This repository was archived by the owner on Oct 2, 2018. It is now read-only.
Closed
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
11 changes: 2 additions & 9 deletions providers/virtualenv.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@
action :create do
unless exists?
Chef::Log.info("Creating virtualenv #{@new_resource} at #{@new_resource.path}")
execute "#{virtualenv_cmd} --python=#{@new_resource.interpreter} #{@new_resource.path}" do
system_site_packages = new_resource.system_site_packages ? '--system-site-packages' : ''
execute "virtualenv --python=#{@new_resource.interpreter} #{system_site_packages} #{@new_resource.path}" do
user new_resource.owner if new_resource.owner
group new_resource.group if new_resource.group
end
Expand Down Expand Up @@ -53,14 +54,6 @@ def load_current_resource
@current_resource
end

def virtualenv_cmd()
if "#{node['python']['install_method']}".eql?("source")
::File.join("#{node['python']['prefix_dir']}","/bin/virtualenv")
else
"virtualenv"
end
end

private
def exists?
::File.exist?(@current_resource.path) && ::File.directory?(@current_resource.path) \
Expand Down
1 change: 1 addition & 0 deletions resources/virtualenv.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,4 @@
attribute :interpreter, :default => 'python2.6'
attribute :owner, :regex => Chef::Config[:user_valid_regex]
attribute :group, :regex => Chef::Config[:group_valid_regex]
attribute :system_site_packages, :default => false