chef-sudo 0.0.1 → 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.rdoc +3 -3
- data/VERSION +1 -1
- data/chef-sudo.gemspec +1 -1
- data/lib/chef-sudo.rb +22 -3
- metadata +2 -2
data/README.rdoc
CHANGED
@@ -1,6 +1,6 @@
|
|
1
|
-
= chef
|
1
|
+
= chef sudo resource
|
2
2
|
|
3
|
-
|
3
|
+
A chef resource which allows executing commands with sudo.
|
4
4
|
|
5
5
|
== Note on Patches/Pull Requests
|
6
6
|
|
@@ -14,4 +14,4 @@ Description goes here.
|
|
14
14
|
|
15
15
|
== Copyright
|
16
16
|
|
17
|
-
Copyright (c) 2010 Mariusz Pietrzyk. See LICENSE for details.
|
17
|
+
Copyright (c) 2010 Mariusz Pietrzyk wijet at wijet dot pl. See LICENSE for details.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0
|
1
|
+
0.1.0
|
data/chef-sudo.gemspec
CHANGED
data/lib/chef-sudo.rb
CHANGED
@@ -41,6 +41,22 @@ class Chef
|
|
41
41
|
:kind_of => [ TrueClass, FalseClass ]
|
42
42
|
)
|
43
43
|
end
|
44
|
+
|
45
|
+
def cwd(arg=nil)
|
46
|
+
set_or_return(
|
47
|
+
:cwd,
|
48
|
+
arg,
|
49
|
+
:kind_of => [ String ]
|
50
|
+
)
|
51
|
+
end
|
52
|
+
|
53
|
+
def environment(arg=nil)
|
54
|
+
set_or_return(
|
55
|
+
:environment,
|
56
|
+
arg,
|
57
|
+
:kind_of => [ Hash ]
|
58
|
+
)
|
59
|
+
end
|
44
60
|
end
|
45
61
|
end
|
46
62
|
end
|
@@ -57,11 +73,14 @@ class Chef
|
|
57
73
|
command << "-g #{@new_resource.group}" if @new_resource.group
|
58
74
|
command << "-i" if @new_resource.simulate_initial_login
|
59
75
|
command << @new_resource.command
|
60
|
-
|
61
|
-
|
76
|
+
|
77
|
+
options = {:command => command.join(' ')}
|
78
|
+
options[:cwd] = @new_resource.cwd if @new_resource.cwd
|
79
|
+
options[:environment] = @new_resource.environment if @new_resource.environment
|
80
|
+
|
81
|
+
Chef::Mixin::Command.run_command(options)
|
62
82
|
Chef::Log.info "Ran sudo [#{@new_resource.name}]"
|
63
83
|
end
|
64
84
|
end
|
65
85
|
end
|
66
86
|
end
|
67
|
-
|