Permalink
Browse files

Added support for virtual environments

  • Loading branch information...
1 parent 14cd44d commit 98c62532b9883209574a2a2d7245d0b69a08d5ac @anthroprose anthroprose committed with sethvargo Jan 28, 2014
Showing with 19 additions and 4 deletions.
  1. +11 −0 README.md
  2. +4 −4 providers/environment.rb
  3. +4 −0 resources/environment.rb
View
@@ -48,6 +48,17 @@ magic_shell_environment 'EDITOR' do
end
```
+Userspace environment variables and permissions for security or virtualenvs
+```ruby
+magic_shell_environment 'EDITOR' do
+ value 'vim'
+ owner 'username'
+ group 'groupname'
+ mode '0600'
+ destination '/home/user/.profile.d/'
+end
+```
+
Contributing
------------
1. Fork the repo
View
@@ -37,9 +37,9 @@ def whyrun_supported?
#
action :add do
file = Chef::Resource::File.new(destination, run_context)
- file.owner('root')
- file.group('root')
- file.mode('0755')
+ file.owner(new_resource.owner)
+ file.group(new_resource.group)
+ file.mode(new_resource.mode)
file.content(<<-EOH.gsub(/^ {8}/, ''))
#
# This file was generated by Chef for #{node['fqdn']}
@@ -60,7 +60,7 @@ def whyrun_supported?
end
def destination
- "/etc/profile.d/#{filename}.sh"
+ "#{new_resource.destination}/#{filename}.sh"
end
def filename
View
@@ -25,3 +25,7 @@
attribute :environment_variable, kind_of: String, name_attribute: true
attribute :value, kind_of: String
+attribute :owner, kind_of: String, default: 'root'
+attribute :group, kind_of: String, default: 'root'
+attribute :mode, kind_of: String, default: '0755'
+attribute :destination, kind_of: String, default: '/etc/profile.d'

0 comments on commit 98c6253

Please sign in to comment.