certmeister-redis 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/certmeister/redis/store.rb +44 -0
- data/spec/certmeister/redis/store_spec.rb +39 -0
- metadata +18 -29
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ff17de81019b42432e18f08956642d4972ef0a3f
|
4
|
+
data.tar.gz: 0fe5a23d672610a4f1fc10e26f5a948425457ba1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d9969df08d48a6891138a1ff2ac3ca5fbd74894c5ece834d03d5232ab9b653719cc3d921843bfb214a57dfe1b1a145072a353ba8be81fdb67e9b231eb6a9eb97
|
7
|
+
data.tar.gz: edef146466471161aad7b1588759ab073b61715b6431a44fb903b860e7a5955afd62387280fa255b7fccd2dfab91d21cc98e160fd37627a38303c6a1deac972f
|
@@ -0,0 +1,44 @@
|
|
1
|
+
module Certmeister
|
2
|
+
|
3
|
+
module Redis
|
4
|
+
|
5
|
+
class Store
|
6
|
+
|
7
|
+
def initialize(redis, environment = "development")
|
8
|
+
@redis = redis
|
9
|
+
@environment = environment
|
10
|
+
@healthy = true
|
11
|
+
end
|
12
|
+
|
13
|
+
def store(cn, pem)
|
14
|
+
@redis.set(pem_key(cn), pem)
|
15
|
+
end
|
16
|
+
|
17
|
+
def fetch(cn)
|
18
|
+
@redis.get(pem_key(cn))
|
19
|
+
end
|
20
|
+
|
21
|
+
def remove(cn)
|
22
|
+
num_removed = @redis.del(pem_key(cn))
|
23
|
+
num_removed == 1
|
24
|
+
end
|
25
|
+
|
26
|
+
def health_check
|
27
|
+
@healthy
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def pem_key(cn)
|
33
|
+
"certmeister:#{@environment}:certificate:#{cn}"
|
34
|
+
end
|
35
|
+
|
36
|
+
def break!
|
37
|
+
@healthy = false
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'certmeister/test/memory_store_interface'
|
3
|
+
|
4
|
+
require 'redis'
|
5
|
+
require 'certmeister/redis/store'
|
6
|
+
|
7
|
+
describe Certmeister::Redis::Store do
|
8
|
+
|
9
|
+
class << self
|
10
|
+
include Certmeister::Test::MemoryStoreInterface
|
11
|
+
end
|
12
|
+
|
13
|
+
let(:redis) { Redis.new }
|
14
|
+
subject { Certmeister::Redis::Store.new(redis, "test") }
|
15
|
+
|
16
|
+
it_behaves_like_a_certmeister_store
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def redis_cleanup
|
21
|
+
["axl.starjuice.net", "axl.hetzner.africa"].each do |cn|
|
22
|
+
redis.del(subject.send(:pem_key, "axl.hetzner.africa"))
|
23
|
+
end
|
24
|
+
leftovers = redis.keys("*")
|
25
|
+
if !leftovers.empty?
|
26
|
+
fail "redis keys not cleaned up: #{leftovers.inspect}"
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
before(:each) do
|
31
|
+
redis_cleanup
|
32
|
+
end
|
33
|
+
|
34
|
+
after(:each) do
|
35
|
+
redis_cleanup
|
36
|
+
end
|
37
|
+
|
38
|
+
end
|
39
|
+
|
metadata
CHANGED
@@ -1,57 +1,43 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: certmeister-redis
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sheldon Hearn
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-01-
|
11
|
+
date: 2014-01-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: certmeister
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '1.5'
|
20
|
-
type: :development
|
21
|
-
prerelease: false
|
22
|
-
version_requirements: !ruby/object:Gem::Requirement
|
23
|
-
requirements:
|
24
|
-
- - ~>
|
17
|
+
- - '='
|
25
18
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
27
|
-
|
28
|
-
name: rake
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
30
|
-
requirements:
|
31
|
-
- - ~>
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
34
|
-
type: :development
|
19
|
+
version: 0.0.2
|
20
|
+
type: :runtime
|
35
21
|
prerelease: false
|
36
22
|
version_requirements: !ruby/object:Gem::Requirement
|
37
23
|
requirements:
|
38
|
-
- -
|
24
|
+
- - '='
|
39
25
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
26
|
+
version: 0.0.2
|
41
27
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
28
|
+
name: redis-sentinel
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
44
30
|
requirements:
|
45
31
|
- - ~>
|
46
32
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
48
|
-
type: :
|
33
|
+
version: '1.4'
|
34
|
+
type: :runtime
|
49
35
|
prerelease: false
|
50
36
|
version_requirements: !ruby/object:Gem::Requirement
|
51
37
|
requirements:
|
52
38
|
- - ~>
|
53
39
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
40
|
+
version: '1.4'
|
55
41
|
description: This gem provides a redis store for use in certmeister, the conditional
|
56
42
|
autosigning certificate authority.
|
57
43
|
email:
|
@@ -59,7 +45,9 @@ email:
|
|
59
45
|
executables: []
|
60
46
|
extensions: []
|
61
47
|
extra_rdoc_files: []
|
62
|
-
files:
|
48
|
+
files:
|
49
|
+
- lib/certmeister/redis/store.rb
|
50
|
+
- spec/certmeister/redis/store_spec.rb
|
63
51
|
homepage: https://github.com/sheldonh/certmeister
|
64
52
|
licenses:
|
65
53
|
- MIT
|
@@ -80,8 +68,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
80
68
|
version: '0'
|
81
69
|
requirements: []
|
82
70
|
rubyforge_project:
|
83
|
-
rubygems_version: 2.1
|
71
|
+
rubygems_version: 2.2.1
|
84
72
|
signing_key:
|
85
73
|
specification_version: 4
|
86
74
|
summary: Redis store for certmeister
|
87
|
-
test_files:
|
75
|
+
test_files:
|
76
|
+
- spec/certmeister/redis/store_spec.rb
|