Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Oct 2, 2018. It is now read-only.

[COOK-1311] Added 'options' for virtualenv command. #10

Merged
merged 2 commits into from
Jun 14, 2012
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
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ Install packages using the new hotness in Python package management...[`pip`](ht
- interpreter: The Python interpreter to use. default is `python2.6`
- owner: The owner for the virtualenv
- group: The group owner of the file (string or id)
- options : Command line options (string)

# Example

Expand All @@ -116,6 +117,14 @@ Install packages using the new hotness in Python package management...[`pip`](ht
action :create
end

# create a Python 2.6 virtualenv with access to the global packages owned by ubuntu user
python_virtualenv "/home/ubuntu/my_old_ve" do
owner "ubuntu"
group "ubuntu"
options "--system-site-packages"
action :create
end

Usage
=====

Expand Down
2 changes: 1 addition & 1 deletion providers/virtualenv.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
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
execute "#{virtualenv_cmd} --python=#{@new_resource.interpreter} #{@new_resource.options} #{@new_resource.path}" do
user new_resource.owner if new_resource.owner
group new_resource.group if new_resource.group
end
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 :options, :kind_of => String