uricp 0.0.11 → 0.0.12

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: 054b98cbf8e67b76cc3e2b552677573fe5b5cbea
4
- data.tar.gz: 85337e7757d5d33a03c72860770dbb10eea58bd8
3
+ metadata.gz: ad39a6e06ce8e9371def28e21ec16e128fd41b89
4
+ data.tar.gz: f9403707e1ffe3fa81efa9f18df76007d5c270c8
5
5
  SHA512:
6
- metadata.gz: 3b774aecb700c7e3b290e2fd3a7140baafe012b188a0f5c9d2166539af35c6f79e6f96cfb92056c1858c0e25e465859492e94e2c5317bfa68d7d5b8c210bca9f
7
- data.tar.gz: f4bf7e1dc1c44c0a712720d54e0f86d4ab95f332b3cdfb20c0dcd431d5d65edfbc674921bba6debdcf8290bc0491ee1476a0686456cb0177d936ba141aed9836
6
+ metadata.gz: 8955d60c70f1092bc8f8cc2fb768c3e80b0450024de3d34141a665efd0989afc6c47de1d8a82d261a1d30751f9ced86213b6bb59e86684e0d838444e6b463942
7
+ data.tar.gz: c4314e1e064c2a4d2db7ebe78c5eaa0626824e4edb10fa623f926eefff9a914c56d1c2ea9646649a217589e039adfe2d8ef72a2f3392e55f750c062201ba4f05
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- uricp (0.0.11)
4
+ uricp (0.0.12)
5
5
  filesize (= 0.0.2)
6
6
  methadone (~> 1.8.0)
7
7
  open4 (~> 1.3.0)
@@ -37,6 +37,14 @@ Feature: Authenticated download of images from orbit
37
37
  And a 0 byte file named "/tmp/uricp/cache/img-zeroy" should exist
38
38
  And the file named "/tmp/uricp/cache/img-zeroy" should have a file format of "raw"
39
39
 
40
+ Scenario: zero download to raw, cache, size limited
41
+ Given a correctly initialised cache at "/tmp/uricp"
42
+ When I retrieve "img-zeroy" with options "--cache=/tmp/uricp --target-format=raw --max-cache=8MB" from container "test" into "file:////tmp/uricp/srv-testx"
43
+ Then a file named "/tmp/uricp/srv-testx" should exist
44
+ And the file named "/tmp/uricp/srv-testx" should have a file format of "raw"
45
+ And a 0 byte file named "/tmp/uricp/cache/img-zeroy" should exist
46
+ And the file named "/tmp/uricp/cache/img-zeroy" should have a file format of "raw"
47
+
40
48
  Scenario: qcow download convert to raw, cache
41
49
  Given a correctly initialised cache at "/tmp/uricp"
42
50
  When I retrieve "img-qcow2" with options "--target-format=raw --cache=/tmp/uricp" from container "test" into "file:///tmp/uricp/srv-test4"
@@ -52,10 +52,19 @@ module Uricp::Strategy
52
52
  end
53
53
 
54
54
  def size_peek
55
+ size_headers=headers
56
+ size_headers['Range'] = 'bytes=0-0'
55
57
  options['from_uri'].open(headers) do |u|
56
58
  match = %r<bytes\s+(\d+)-(\d+)/(\d+|\*)>i.match(u.meta['content-range'])
57
59
  match && match[3].to_i
58
60
  end
61
+ rescue OpenURI::HTTPError => e
62
+ case e.io.status[0]
63
+ when '416'
64
+ 0
65
+ else
66
+ raise
67
+ end
59
68
  rescue SocketError => e
60
69
  raise SocketError, options['from_uri'].to_s+" inaccessible: "+e.message
61
70
  end
data/lib/uricp/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  module Uricp
2
- VERSION = "0.0.11"
2
+ VERSION = "0.0.12"
3
3
  DEFAULT_SEGMENT_SIZE = "5 GiB"
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uricp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.11
4
+ version: 0.0.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Neil Wilson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-18 00:00:00.000000000 Z
11
+ date: 2015-10-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler