right_scraper 5.2.8 → 5.3.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: 91364df79700801d6523594f7c89b052ff240e63
4
- data.tar.gz: c3bccc9a05fbb13b21dc7901ab95f7ccdd86121b
3
+ metadata.gz: fbe07e9cf37a9a0238de7b1a24a8441df3217d69
4
+ data.tar.gz: 9bd77beb7c966c4b131109633e4684c06903ba9c
5
5
  SHA512:
6
- metadata.gz: 7ebe33e725fb0d117cbd7d8890f4d1edcf6e74582f3ddf4d83b2eb08fece23f7c4e677c8801b836b2e5b8e8d37f8964f6b78e75d65368b012fab6c9685d887dc
7
- data.tar.gz: cde2a6855873730f0704fcb499e0335bf8c05d54890660b808ebb931fdc93419417ebd6c5743c6ec6c25c4dccf11006ec0a82fe6ce159b03ab68b250c4fd5d7f
6
+ metadata.gz: 462d861098695ee9f831874d613d498d1bae887d4449fd70390381cfdefcc4af77440d4372017dabcf05a0c5443215144fea4b3ec5c1fbdc72fe3a7210146425
7
+ data.tar.gz: 2a3a59bc1391c2562b804eed520a8314372e400b92e5dbede329fea0a5d85dae4a5ebbf31f0db391f653cef69f247137a07b9446e1a5992827ecfe5c4fc9783f
@@ -26,6 +26,7 @@ require 'right_scraper/scanners'
26
26
 
27
27
  require 'fileutils'
28
28
  require 'json'
29
+ require 'right_git'
29
30
  require 'right_popen'
30
31
  require 'right_popen/safe_output_buffer'
31
32
  require 'tmpdir'
@@ -37,11 +38,13 @@ module RightScraper::Scanners
37
38
  JSON_METADATA = 'metadata.json'
38
39
  RUBY_METADATA = 'metadata.rb'
39
40
 
40
- UNDEFINED_COOKBOOK_NAME = 'undefined'
41
+ UNDEFINED_COOKBOOK_NAME = 'undefined'
41
42
  KNIFE_METADATA_SCRIPT_NAME = 'knife_metadata.rb'
43
+ KNIFE_METADATA_TIMEOUT = 60 # 1m
42
44
 
43
45
  JAILED_FILE_SIZE_CONSTRAINT = 128 * 1024 # 128 KB
44
- FREED_FILE_SIZE_CONSTRAINT = 64 * 1024 # 64 KB
46
+ FREED_FILE_SIZE_CONSTRAINT = 64 * 1024 # 64 KB
47
+
45
48
 
46
49
  attr_reader :freed_dir
47
50
 
@@ -244,16 +247,19 @@ module RightScraper::Scanners
244
247
  # imposed on the current process by a container (timeout, memory, etc.)
245
248
  shell = ::RightGit::Shell::Default
246
249
  output = StringIO.new
247
- exitstatus = shell.execute(
248
- "#{ruby} #{dst_knife_script_path.inspect} #{jailed_cookbook_dir.inspect} 2>&1",
249
- directory: dst_knife_script_dir,
250
- outstream: output,
251
- raise_on_failure: false,
252
- set_env_vars: { LC_ALL: 'en_US.UTF-8' }, # character encoding for emitted JSON
253
- clear_env_vars: %w{BUNDLE_BIN_PATH BUNDLE_GEMFILE})
254
- if exitstatus != 0
250
+ begin
251
+ shell.execute(
252
+ "#{ruby} #{dst_knife_script_path.inspect} #{jailed_cookbook_dir.inspect} 2>&1",
253
+ directory: dst_knife_script_dir,
254
+ outstream: output,
255
+ raise_on_failure: true,
256
+ set_env_vars: { LC_ALL: 'en_US.UTF-8' }, # character encoding for emitted JSON
257
+ clear_env_vars: %w{BUNDLE_BIN_PATH BUNDLE_GEMFILE},
258
+ timeout: KNIFE_METADATA_TIMEOUT)
259
+ output = output.string
260
+ rescue ::RightGit::Shell::ShellError => e
255
261
  output = output.string
256
- raise MetadataError, "Failed to run chef knife: #{output[0, 1024]}"
262
+ raise MetadataError, "Failed to run chef knife: #{e.message}\n#{output[0, 1024]}"
257
263
  end
258
264
 
259
265
  # free files from jail.
@@ -23,7 +23,7 @@
23
23
 
24
24
  module RightScraper
25
25
  # for gemspec, etc.
26
- GEM_VERSION = '5.2.8'
26
+ GEM_VERSION = '5.3.1'
27
27
 
28
28
  # (Fixnum) protocol versioning scheme; prepended to hashes to
29
29
  # prevent collisions.
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: right_scraper
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.2.8
4
+ version: 5.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Raphael Simon
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-03-30 00:00:00.000000000 Z
13
+ date: 2016-04-01 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: right_aws