kitchen-habitat 0.2.1 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b3cfd87a1c1b1560550515c1ebf90f1bb8cdcd6d
4
- data.tar.gz: 0684ac8b206395fc06d5121d1ad94e3729e5ebab
3
+ metadata.gz: f8f5bd09f9be9941cb4fbb5854d6e190133ac755
4
+ data.tar.gz: d282775cb109380519f3163f053f3586afa4db62
5
5
  SHA512:
6
- metadata.gz: 98dd5a5ad196817c5b2d6e98ae5080f67472514ea11fbdfa8d87ebd2a29e0dadd3afbaeea9084f18ecb5dfe5acb9a4c6a5a2ddf6bb8ad28db816b3c1f262f736
7
- data.tar.gz: 27deaca029a46bc1f921ec28334f17a724f14a2b5e7a36f29f16572b5ac01a74235744260c576f0cea969c60548602974826f421e01d2c0e8c12595f57f7725d
6
+ metadata.gz: 5697def2efc706d739ae06182d8b430e623405a5e0e488817a8c8f076ea84075d81e52d88606ad5ff6ecf64e7e18205067bfac90556b2502081293ef8aac76b0
7
+ data.tar.gz: 70a4508a072c3f752082be170ec8d8d1db45c4357ed51edefc99bbcfe6cba0d2e1511190e5c0ee34f6db3e15a192699bf4cf4c667945220daca9c741aa4a86cc
@@ -105,12 +105,11 @@ module Kitchen
105
105
 
106
106
  def run_command
107
107
  run = <<-RUN
108
- #{clean_up_screen_sessions}
109
108
  #{export_hab_origin}
109
+ #{clean_up_screen_sessions}
110
+ #{clean_up_previous_supervisor}
110
111
  echo "Running #{package_ident}."
111
-
112
112
  #{run_package_in_background}
113
- sleep 5
114
113
  RUN
115
114
 
116
115
  wrap_shell_code run
@@ -131,11 +130,26 @@ module Kitchen
131
130
  CLEAN
132
131
  end
133
132
 
133
+ def clean_up_previous_supervisor
134
+ return if config[:use_screen]
135
+ <<-EOH
136
+ [ -f ./run.pid ] && echo "Removing previous supervisor. "
137
+ [ -f ./run.pid ] && sudo kill $(cat run.pid)
138
+ [ -f ./run.pid ] && sleep 5
139
+ EOH
140
+ end
141
+
134
142
  def run_package_in_background
135
143
  if config[:use_screen]
136
144
  "sudo screen -mdS \"#{clean_package_name}\" hab-sup start #{package_ident} #{supervisor_options}"
137
145
  else
138
- "nohup sudo hab-sup start #{package_ident} #{supervisor_options} & echo $! > run.pid"
146
+ <<-RUN
147
+ [ -f ./run.pid ] && rm -f run.pid
148
+ [ -f ./nohup.out ] && rm -f nohup.out
149
+ nohup sudo hab-sup start #{package_ident} #{supervisor_options} & echo $! > run.pid
150
+ sleep 5
151
+ [ -f ./nohup.out ] && cat nohup.out || (echo "Failed to start the supervisor." && exit 1)
152
+ RUN
139
153
  end
140
154
  end
141
155
 
@@ -1,5 +1,5 @@
1
1
  module Kitchen
2
2
  module Habitat
3
- VERSION = "0.2.1".freeze
3
+ VERSION = "0.2.4".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kitchen-habitat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Murawski
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-03 00:00:00.000000000 Z
11
+ date: 2017-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: test-kitchen