hiera-eyaml-gpg 0.2 → 0.3

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,6 +1,6 @@
1
1
  source 'https://rubygems.org/'
2
2
 
3
- gem 'hiera-eyaml', ">=1.3.4"
3
+ gem 'hiera-eyaml', ">=1.3.8"
4
4
  gem 'gpgme', ">=2.0.0"
5
5
 
6
6
  group :development do
@@ -17,6 +17,6 @@ Gem::Specification.new do |gem|
17
17
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
18
  gem.require_paths = ["lib"]
19
19
 
20
- gem.add_dependency('hiera-eyaml', '>=1.3.4')
20
+ gem.add_dependency('hiera-eyaml', '>=1.3.8')
21
21
  gem.add_dependency('gpgme', '>=2.0.0')
22
22
  end
@@ -101,9 +101,14 @@ class Hiera
101
101
  recipients = self.find_recipients
102
102
  debug("Recipents are #{recipients}")
103
103
 
104
- raise ArgumentError, 'No recipients provided, don\'t know who to encrypt to' if recipients.empty?
104
+ raise RecoverableError, 'No recipients provided, don\'t know who to encrypt to' if recipients.empty?
105
105
 
106
- keys = recipients.map {|r| ctx.keys(r).first }
106
+ keys = recipients.map {|r|
107
+ key_to_use = ctx.keys(r).first
108
+ if key_to_use.nil?
109
+ raise RecoverableError, "No key found on keyring for #{r}"
110
+ end
111
+ }
107
112
  debug("Keys: #{keys}")
108
113
 
109
114
  always_trust = self.option(:always_trust)
@@ -112,7 +117,7 @@ class Hiera
112
117
  # error that it would spit out otherwise)
113
118
  keys.each do |key|
114
119
  unless key.primary_uid.validity >= GPGME::VALIDITY_FULL
115
- raise StandardError, "Key #{key.sha} (#{key.email}) not trusted (if key trust is established by another means then specify always-trust)"
120
+ raise RecoverableError, "Key #{key.sha} (#{key.email}) not trusted (if key trust is established by another means then specify always-trust)"
116
121
  end
117
122
  end
118
123
  end
@@ -3,7 +3,7 @@ class Hiera
3
3
  module Eyaml
4
4
  module Encryptors
5
5
  module Gpg
6
- VERSION = "0.2"
6
+ VERSION = "0.3"
7
7
  end
8
8
  end
9
9
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hiera-eyaml-gpg
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.2'
4
+ version: '0.3'
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-11-07 00:00:00.000000000 Z
12
+ date: 2013-11-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: hiera-eyaml
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
- version: 1.3.4
21
+ version: 1.3.8
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ! '>='
28
28
  - !ruby/object:Gem::Version
29
- version: 1.3.4
29
+ version: 1.3.8
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: gpgme
32
32
  requirement: !ruby/object:Gem::Requirement