rh_entitlement 0.3.0 → 0.4.0
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 +4 -4
- data/README.md +1 -1
- data/lib/rh_entitlement/lookup.rb +48 -0
- data/lib/rh_entitlement.rb +1 -0
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d41c843a49a98958f94140c6b052f944da963d62
|
|
4
|
+
data.tar.gz: 804df2290619e28576ca0e141e33aa04adb1fbe3
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 55aa9e5f26cdb7c235df7662df14c2b4e86de59b1e2a502082ef8a53820673ae8a18dbdb7fcadd1acc65b910301c30606b624e940c5f32499f1796fe324e8ac2
|
|
7
|
+
data.tar.gz: eb989b810fbcd76e6949d1eb8509110a97b2d08297dd91d9caf07aa5180c76a1ff8423331d5f7adaebea8b33aecb6c6437d6524fce4f49551b38f8fc9c17b4df
|
data/README.md
CHANGED
|
@@ -125,7 +125,7 @@ The Huffman Coding has been forked and refactored from the rspec helper in
|
|
|
125
125
|
|
|
126
126
|
## Development
|
|
127
127
|
|
|
128
|
-
Questions or problems? Please post them on the [issue tracker](https://github.com/Thomas-Gelf/rubygem-
|
|
128
|
+
Questions or problems? Please post them on the [issue tracker](https://github.com/Thomas-Gelf/rubygem-rh_entitlement/issues).
|
|
129
129
|
You can contribute changes by forking the project and submitting a pull request.
|
|
130
130
|
|
|
131
131
|
This gem has been created by Thomas Gelf and is under the GPLv2 License.
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
module RhEntitlement
|
|
2
|
+
class Lookup
|
|
3
|
+
def initialize
|
|
4
|
+
@entitlements = {}
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
def add_path(path)
|
|
8
|
+
return unless File.directory? path
|
|
9
|
+
Dir.glob("#{path}/*.pem").grep(/\/\d+\.pem$/).each do |filename|
|
|
10
|
+
add_certificate_file(filename)
|
|
11
|
+
end
|
|
12
|
+
self
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
def add_certificate_file(filename)
|
|
16
|
+
add_cert(File.basename(filename).sub('.pem', ''), File.read(filename))
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def entitlements
|
|
20
|
+
add_path('/etc/pki/entitlement') if @entitlements.empty?
|
|
21
|
+
@entitlements
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def add_cert(key, cert)
|
|
25
|
+
@entitlements[key] = RhEntitlement::Certificate.new(cert)
|
|
26
|
+
self
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def add_certs(certs)
|
|
30
|
+
certs.each do |key, cert|
|
|
31
|
+
add_cert key, cert
|
|
32
|
+
end
|
|
33
|
+
self
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def find_url(url)
|
|
37
|
+
entitlements.each do |key, entitlement|
|
|
38
|
+
return key if entitlement.urls.has?(url)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
nil
|
|
42
|
+
end
|
|
43
|
+
|
|
44
|
+
def self.instance
|
|
45
|
+
@@instance ||= new
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
end
|
data/lib/rh_entitlement.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: rh_entitlement
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Thomas Gelf
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2018-06-
|
|
11
|
+
date: 2018-06-22 00:00:00.000000000 Z
|
|
12
12
|
dependencies: []
|
|
13
13
|
description: Helper library allowing one to deal with RH entitlement certs
|
|
14
14
|
email: thomas@gelf.net
|
|
@@ -24,6 +24,7 @@ files:
|
|
|
24
24
|
- lib/rh_entitlement/certificate.rb
|
|
25
25
|
- lib/rh_entitlement/certificate_urls.rb
|
|
26
26
|
- lib/rh_entitlement/huffman_encoding.rb
|
|
27
|
+
- lib/rh_entitlement/lookup.rb
|
|
27
28
|
homepage: https://github.com/Thomas-Gelf/rubygem-rh_entitlement
|
|
28
29
|
licenses:
|
|
29
30
|
- GPL-2.0
|