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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d638957343d75f83244b7d7589662ee2364c7bd6
4
- data.tar.gz: a16ef58fad113e7e9e58305a8ec4146d604bf7ff
3
+ metadata.gz: 1dc4224d3244676e5064fef59a56e66af7a98977
4
+ data.tar.gz: 9f2a56ff1bf509cf3433ef8319fb9c3265a09c93
5
5
  SHA512:
6
- metadata.gz: 498492872c31a830b67dc9cbcd2fbef34b8149aa2391428540168a93e0268fbcfa37f2655b93d14fff502cf4144f128357f2be26b6e1349677f7dc317f8cfb14
7
- data.tar.gz: c671b47059e43d9560d5ecc50580e0b9a0a3e7aa24b81c3f1951ea084fdbbbe85e92990682d8802e338f09129b1aab65a3082634383d23cae51762d29973bc75
6
+ metadata.gz: d98cd01c2f026fc9dd3214ac63ffc32730ee573948bef25928cec4f7bde700fe767597d30a4c417f7218960cf7553601899f41ae6f59af89cf6f2f9e0ac68cbe
7
+ data.tar.gz: 9a456405ccc42069c96bc74ff9d86f7762f021ef61ec3c3aea0bfb2cf82d56a31f959ca9b29a1b05fbbe52e25f7eecb990532cd6adfaf9c18afa5e4b3565d893
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## 0.6.1
2
+ - Move to home directory if user attribute is specified
3
+
1
4
  ## 0.6.0
2
5
  - Add `cwd` and `user` attributes on all resources
3
6
 
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 for `sudo -u`
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
- command = "cd #{Shellwords.escape(cwd)} && #{command}" unless cwd.nil?
229
- command = "sudo -u #{user} -- /bin/sh -c #{Shellwords.escape(command)}" unless user.nil?
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
 
@@ -1,3 +1,3 @@
1
1
  module Serverkit
2
- VERSION = "0.6.0"
2
+ VERSION = "0.6.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: serverkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryo Nakamura