right_scraper 5.2.3 → 5.2.4

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: 5e3e56526cb55dd6f512036c2f09bba4482877f7
4
- data.tar.gz: 1530ce3466c3ca85870bb34994b3755bdd71e343
3
+ metadata.gz: 72742c44a4b3b388890b5b5cfeca507fd73f1378
4
+ data.tar.gz: a105f03f00ecfdda21074cfd95833555f4c8f8bc
5
5
  SHA512:
6
- metadata.gz: 8a41b45ff42e741c2a2bf39511624a5f9a94a0f838d584f0ce7a2bde7ad02eef62fb5002e751764dc846c80df86f8b20ac79cae05bf8ee57cab06738482c3dd0
7
- data.tar.gz: 82e8795bee0fa38a5b4d5d8841820187773c2bcccf6def8b2ede9cc6955593e4b58c072b80bf03d8da87299ea111e51042a5d7674db6ff586012193d6d1feda5
6
+ metadata.gz: 4f7e803cab8c2a9bfe872e80280bf5aa3af99adbd9531b4a821f4ebc0e2c04db5db64bdca1970376ef967703977eb72a3f3216f6cf76695f60d1c907f139a8cd
7
+ data.tar.gz: fc00f4ecc3f8f9cdf53dc5d75c693a42abbf31f107b592f41ae49a01a667218210337b518141f85c2b7f6eb07668e4d85d0dfc3919f2e838ebc5c69c3eded083
@@ -69,14 +69,14 @@ begin
69
69
  exit 0
70
70
  rescue ::RightScraper::Error, ::RightGit::Shell::ShellError => e
71
71
  # all explicitly raised scraper errors derive from these errors.
72
- result = { errors: [e.message] }
72
+ result = { errors: [[e.class, :retreive, e.message]] }
73
73
  $stderr.puts(::JSON.generate(result))
74
74
  exit 3
75
75
  rescue ::SystemExit => e
76
76
  exit e.status
77
77
  rescue ::Exception => e
78
78
  result = {
79
- errors: ['internal error'],
79
+ errors: [[e.class, :internal_error, e.message]],
80
80
  unhandled_exception: {
81
81
  class: e.class,
82
82
  message: e.message,
@@ -88,3 +88,5 @@ rescue ::Exception => e
88
88
  ensure
89
89
  main.cleanup rescue nil if main
90
90
  end
91
+
92
+ @logger.note_error($!, :available, "download retriever is unavailable")
@@ -65,7 +65,7 @@ begin
65
65
  # CookbookMetadata. the reason is that we expect this scanner to only be
66
66
  # called in unprivileged isolation followed by more scanners with more
67
67
  # privileges and only the latter need to return fully resolved resources.
68
- if main.scanners != [RightScraper::Scanners::CookbookMetadata]
68
+ if main.scanners != [::RightScraper::Scanners::CookbookMetadata]
69
69
  result[:resources] = main.resources.map do |r|
70
70
  # remove relational repository from each returned cookbook due to being
71
71
  # the same for each resource and already known to caller.
@@ -83,14 +83,14 @@ begin
83
83
  exit 0
84
84
  rescue ::RightScraper::Error, ::RightGit::Shell::ShellError => e
85
85
  # all explicitly raised scraper errors derive from these errors.
86
- result = { errors: [e.message] }
86
+ result = { errors: [[e.class, :scan, e.message]] }
87
87
  $stderr.puts(::JSON.generate(result))
88
88
  exit 3
89
89
  rescue ::SystemExit => e
90
90
  exit e.status
91
91
  rescue ::Exception => e
92
92
  result = {
93
- errors: ['internal error'],
93
+ errors: [[e.class, :internal_error, e.message]],
94
94
  unhandled_exception: {
95
95
  class: e.class,
96
96
  message: e.message,
@@ -38,8 +38,7 @@ module RightScraper
38
38
  # class functionality.
39
39
  class Main
40
40
 
41
- # (Array):: Scraped resources
42
- attr_reader :resources
41
+ attr_reader :logger, :resources
43
42
 
44
43
  # Initialize scrape destination directory
45
44
  #
@@ -61,7 +60,6 @@ module RightScraper
61
60
  :scanners => nil,
62
61
  :builders => nil,
63
62
  ).merge(options)
64
- @old_logger_callback = nil
65
63
  @temporary = !options.has_key?(:basedir)
66
64
  options[:basedir] ||= Dir.mktmpdir
67
65
  options[:logger] ||= ::RightScraper::Loggers::Default.new
@@ -110,12 +108,12 @@ module RightScraper
110
108
  # === Raise
111
109
  # 'Invalid repository type':: If repository type is not known
112
110
  def scrape(repo, incremental=true, &callback)
113
- @old_logger_callback = @logger.callback
111
+ old_logger_callback = @logger.callback
114
112
  @logger.callback = callback
115
113
  errorlen = errors.size
116
114
  begin
117
- if retrieved = retrieve(repo, &callback)
118
- scan(retrieved, &callback)
115
+ if retrieved = retrieve(repo)
116
+ scan(retrieved)
119
117
  end
120
118
  rescue Exception
121
119
  # legacy logger handles communication with the end user and appending
@@ -123,6 +121,7 @@ module RightScraper
123
121
  # has no such guaranteed communication so the caller will decide how to
124
122
  # handle errors, etc.
125
123
  ensure
124
+ @logger.callback = old_logger_callback
126
125
  cleanup
127
126
  end
128
127
  errors.size == errorlen
@@ -188,8 +187,6 @@ module RightScraper
188
187
 
189
188
  # cleans up temporary files, etc.
190
189
  def cleanup
191
- @logger.callback = @old_logger_callback
192
- @old_logger_callback = nil
193
190
  ::FileUtils.remove_entry_secure(base_dir) rescue nil if @temporary
194
191
  end
195
192
 
@@ -23,7 +23,7 @@
23
23
 
24
24
  module RightScraper
25
25
  # for gemspec, etc.
26
- GEM_VERSION = '5.2.3'
26
+ GEM_VERSION = '5.2.4'
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.3
4
+ version: 5.2.4
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-21 00:00:00.000000000 Z
13
+ date: 2016-03-23 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: right_aws