docker_registry2 0.7.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -2
- data/lib/docker_registry2.rb +2 -2
- data/lib/registry/registry.rb +3 -7
- data/lib/registry/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3a8e38262e00c15c3706999d7d5283a6f9b13ff0
|
4
|
+
data.tar.gz: 5fe67075919b2a2d3d70077fbc327dc0f9a5a9f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3d369e8f8f55e20601637fe62089db93d178a025fcf67caaf69287f808df47fe8bf062afab68c55ec17c6a7beee5352e9d1866461c80a579ea20386ef6193f53
|
7
|
+
data.tar.gz: 49861378fac8d26ccd3558206bb4f87f45322d89422ad5efcdecf6fcb55400a26bb406be65a765730830d8e70c26e77875306e73114206dc4546d40b6330cf9b
|
data/README.md
CHANGED
@@ -66,12 +66,16 @@ The following exceptions are thrown:
|
|
66
66
|
* `RegistrySSLException`: registry SSL certificate cannot be validated
|
67
67
|
|
68
68
|
#### Authenticated
|
69
|
-
If you wish to authenticate, pass a username and password as part of the
|
69
|
+
If you wish to authenticate, pass a username and password as part of the options to `DockerRegistry.connect`.
|
70
70
|
|
71
71
|
````ruby
|
72
|
-
|
72
|
+
url = "https://my.registy.corp.com"
|
73
|
+
opts = {user: "me", password: "secretstuff"}
|
74
|
+
reg = DockerRegistry2.connect(url,opts)
|
73
75
|
````
|
74
76
|
|
77
|
+
**Note:** Older versions prior to 1.0.0 _used_ to support putting the username and password in the URL. We no longer support it as it is **strongly** discouraged in RFCs. Put it in the `opts` hash.
|
78
|
+
|
75
79
|
The following exceptions are thrown:
|
76
80
|
|
77
81
|
* `RegistryAuthenticationException`: username/password combination is invalid
|
data/lib/docker_registry2.rb
CHANGED
@@ -4,8 +4,8 @@ require File.dirname(__FILE__) + '/registry/exceptions'
|
|
4
4
|
|
5
5
|
|
6
6
|
module DockerRegistry2
|
7
|
-
def self.connect(uri="https://registry.hub.docker.com")
|
8
|
-
@reg = DockerRegistry2::Registry.new(uri)
|
7
|
+
def self.connect(uri="https://registry.hub.docker.com",opts={})
|
8
|
+
@reg = DockerRegistry2::Registry.new(uri,opts)
|
9
9
|
end
|
10
10
|
|
11
11
|
def self.search(query = '')
|
data/lib/registry/registry.rb
CHANGED
@@ -10,8 +10,8 @@ class DockerRegistry2::Registry
|
|
10
10
|
def initialize(uri, options = {})
|
11
11
|
@uri = URI.parse(uri)
|
12
12
|
@base_uri = "#{@uri.scheme}://#{@uri.host}:#{@uri.port}"
|
13
|
-
@user =
|
14
|
-
@password =
|
13
|
+
@user = options[:user]
|
14
|
+
@password = options[:password]
|
15
15
|
# make a ping connection
|
16
16
|
ping
|
17
17
|
end
|
@@ -193,12 +193,8 @@ class DockerRegistry2::Registry
|
|
193
193
|
end
|
194
194
|
# authenticate against the realm
|
195
195
|
uri = URI.parse(target[:realm])
|
196
|
-
uri.user = @user if defined? @user
|
197
|
-
uri.password = @password if defined? @password
|
198
196
|
begin
|
199
|
-
|
200
|
-
# target[:params]['scope'] = 'repository'
|
201
|
-
response = RestClient.get uri.to_s, {params: target[:params]}
|
197
|
+
response = RestClient::Request.execute method: :get, url: uri.to_s, headers: {params: target[:params]}, user: @user, password: @password
|
202
198
|
rescue RestClient::Unauthorized
|
203
199
|
# bad authentication
|
204
200
|
raise DockerRegistry2::RegistryAuthenticationException
|
data/lib/registry/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: docker_registry2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Avi Deitcher https://github.com/deitch
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2017-
|
13
|
+
date: 2017-06-16 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|