taste_tester 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/bin/taste-tester CHANGED
@@ -15,6 +15,8 @@
15
15
  # See the License for the specific language governing permissions and
16
16
  # limitations under the License.
17
17
 
18
+ $LOAD_PATH.unshift(File.dirname(File.realpath(__FILE__)) + '/../lib')
19
+
18
20
  # rubocop:disable UnusedBlockArgument, AlignParameters
19
21
  if ENV['MY_RUBY_HOME'] && ENV['MY_RUBY_HOME'].include?('rvm')
20
22
  puts 'Please disable RVM before running taste-tester'
@@ -42,9 +42,14 @@ module TasteTester
42
42
  :checksum_dir => TasteTester::Config.checksum_dir,
43
43
  )
44
44
  @knife.write_user_config
45
- @repo = BetweenMeals::Repo.get(TasteTester::Config.repo_type,
46
- TasteTester::Config.repo, logger)
47
- fail 'Could not read repo' unless @repo
45
+ @repo = BetweenMeals::Repo.get(
46
+ TasteTester::Config.repo_type,
47
+ TasteTester::Config.repo,
48
+ logger,
49
+ )
50
+ unless @repo.exists?
51
+ fail "Could not open repo from #{TasteTester::Config.repo}"
52
+ end
48
53
  end
49
54
 
50
55
  def checks
@@ -34,8 +34,7 @@ module TasteTester
34
34
 
35
35
  def self.restart
36
36
  server = TasteTester::Server.new
37
- server.stop if TasteTester::Server.running?
38
- server.start
37
+ server.restart
39
38
  end
40
39
 
41
40
  def self.stop
@@ -78,8 +77,14 @@ module TasteTester
78
77
  upload
79
78
  end
80
79
  server = TasteTester::Server.new
81
- repo = BetweenMeals::Repo.get(TasteTester::Config.repo_type,
82
- TasteTester::Config.repo, logger)
80
+ repo = BetweenMeals::Repo.get(
81
+ TasteTester::Config.repo_type,
82
+ TasteTester::Config.repo,
83
+ logger,
84
+ )
85
+ unless repo.exists?
86
+ fail "Could not open repo from #{TasteTester::Config.repo}"
87
+ end
83
88
  unless TasteTester::Config.skip_pre_test_hook
84
89
  TasteTester::Hooks.pre_test(TasteTester::Config.dryrun, repo, hosts)
85
90
  end
@@ -153,6 +158,18 @@ module TasteTester
153
158
  client.skip_checks = true if TasteTester::Config.skip_checks
154
159
  client.force = true if TasteTester::Config.force_upload
155
160
  client.upload
161
+ rescue => exception
162
+ errors = ['Cannot find a cookbook named', 'Connection reset by peer']
163
+ if errors.any? { |e| exception.to_s.match(/#{e}/im) }
164
+ TasteTester::Config.force_upload = true
165
+ unless @already_retried
166
+ @already_retried = true
167
+ retry
168
+ end
169
+ end
170
+ logger.error("Upload failed")
171
+ logger.error(e.to_s)
172
+ exit 1
156
173
  end
157
174
  end
158
175
  end
@@ -66,14 +66,15 @@ module TasteTester
66
66
 
67
67
  def start
68
68
  return if TasteTester::Server.running?
69
- @state.wipe
70
69
  logger.warn('Starting taste-tester server')
70
+ @state.wipe
71
71
  write_config
72
72
  start_chef_zero
73
73
  end
74
74
 
75
75
  def stop
76
76
  logger.warn('Stopping taste-tester server')
77
+ @state.wipe
77
78
  stop_chef_zero
78
79
  end
79
80
 
@@ -125,8 +126,9 @@ module TasteTester
125
126
  end
126
127
 
127
128
  def start_chef_zero
128
- @state.wipe
129
- @state.port = TasteTester::Config.chef_port
129
+ unless @state.port
130
+ @state.port = TasteTester::Config.chef_port
131
+ end
130
132
  logger.info("Starting chef-zero of port #{@state.port}")
131
133
  Mixlib::ShellOut.new(
132
134
  "/opt/chef/embedded/bin/chef-zero --host #{@addr}" +
@@ -135,7 +137,6 @@ module TasteTester
135
137
  end
136
138
 
137
139
  def stop_chef_zero
138
- @state.wipe
139
140
  logger.info('Killing your chef-zero instances')
140
141
  s = Mixlib::ShellOut.new("pkill -9 -u #{ENV['USER']} -f bin/chef-zero")
141
142
  s.run_command
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: taste_tester
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2014-09-23 00:00:00.000000000 Z
13
+ date: 2014-10-15 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: mixlib-config
@@ -71,16 +71,16 @@ extra_rdoc_files:
71
71
  files:
72
72
  - README.md
73
73
  - LICENSE
74
- - lib/taste_tester/host.rb
75
- - lib/taste_tester/ssh.rb
76
- - lib/taste_tester/tunnel.rb
77
- - lib/taste_tester/server.rb
78
- - lib/taste_tester/client.rb
79
74
  - lib/taste_tester/hooks.rb
80
- - lib/taste_tester/config.rb
81
75
  - lib/taste_tester/logging.rb
82
- - lib/taste_tester/state.rb
83
76
  - lib/taste_tester/commands.rb
77
+ - lib/taste_tester/tunnel.rb
78
+ - lib/taste_tester/host.rb
79
+ - lib/taste_tester/state.rb
80
+ - lib/taste_tester/client.rb
81
+ - lib/taste_tester/config.rb
82
+ - lib/taste_tester/server.rb
83
+ - lib/taste_tester/ssh.rb
84
84
  - bin/taste-tester
85
85
  - scripts/taste-untester
86
86
  homepage: https://github.com/facebook/taste-tester