serverkit 0.6.0 → 0.6.1
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/doc/resource.md +1 -1
- data/lib/serverkit/resources/base.rb +9 -2
- data/lib/serverkit/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1dc4224d3244676e5064fef59a56e66af7a98977
|
4
|
+
data.tar.gz: 9f2a56ff1bf509cf3433ef8319fb9c3265a09c93
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d98cd01c2f026fc9dd3214ac63ffc32730ee573948bef25928cec4f7bde700fe767597d30a4c417f7218960cf7553601899f41ae6f59af89cf6f2f9e0ac68cbe
|
7
|
+
data.tar.gz: 9a456405ccc42069c96bc74ff9d86f7762f021ef61ec3c3aea0bfb2cf82d56a31f959ca9b29a1b05fbbe52e25f7eecb990532cd6adfaf9c18afa5e4b3565d893
|
data/CHANGELOG.md
CHANGED
data/doc/resource.md
CHANGED
@@ -11,7 +11,7 @@ By default, all types of resource can or must have the following attributes:
|
|
11
11
|
- id - change resource identifier used in log, and also used for `notify`
|
12
12
|
- notify - specify an Array of handler ids that should be applied after changed
|
13
13
|
- recheck_script - pass shell script to override the `#recheck` phase (runned after `#apply`)
|
14
|
-
- user - specify user
|
14
|
+
- user - specify user who executes commands on remote machine
|
15
15
|
|
16
16
|
## Example
|
17
17
|
Here is a tiny example recipe that has only one resource with `type` and `name` attributes.
|
@@ -225,8 +225,15 @@ module Serverkit
|
|
225
225
|
# @param [String] command one-line shell script to be executed on remote machine
|
226
226
|
# @return [Specinfra::CommandResult]
|
227
227
|
def run_command(command)
|
228
|
-
|
229
|
-
|
228
|
+
case
|
229
|
+
when cwd
|
230
|
+
command = "cd #{Shellwords.escape(cwd)} && #{command}"
|
231
|
+
when user
|
232
|
+
command = "cd && #{command}"
|
233
|
+
end
|
234
|
+
unless user.nil?
|
235
|
+
command = "sudo -u #{user} -- /bin/sh -c #{Shellwords.escape(command)}"
|
236
|
+
end
|
230
237
|
backend.run_command(command)
|
231
238
|
end
|
232
239
|
|
data/lib/serverkit/version.rb
CHANGED