cheffish 2.0.4 → 2.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a770a15bb48a8939bddbac6cbf95661afe11ea8c
4
- data.tar.gz: 3233751aaa45372d416ac070eaa622e23879c989
3
+ metadata.gz: 9604eb3cba629ceef8d7e57aa5009d0cbbca6b7e
4
+ data.tar.gz: 7f8f7a795195719ad566edcb42df0486633236f0
5
5
  SHA512:
6
- metadata.gz: ba67174d5be4f0c5a632002774a9c01815f19e1fa5112a71bc34ed2b7eeb83d5ae6df0f19707b3163c81cc50748b1c155a7fd42adf51588d8bcd110164cda62f
7
- data.tar.gz: 3ef33eaf368193fe7f922dd3aaa82cd5d83c3bde5509135f8c080a53636060a98d797bdda7be487f99cd835f149678302a99ad6875e1c425080c3782c86d3cda
6
+ metadata.gz: acdaabb743e1003022f2282e041d0fdcccf7e8ed8c7ce7928b2dcf021ad51dfd9ad8fac9fca7d7a63ff910b9b933b9f0648c107b760716b61f06133869c92165
7
+ data.tar.gz: d9280f736b9ad162c83da2a435a7f75edc3c45b26f37f975b0120017f65fe6f886c1f6f145bdb5c513c530057ea6fa5b170db67684aa27a3d37cd07b4890b3e1
@@ -37,7 +37,13 @@ class Chef
37
37
  property :raw_data, Hash
38
38
 
39
39
  # If secret or secret_path are set, encrypt is assumed true. encrypt exists mainly for with_secret and with_secret_path
40
- property :encrypt, Boolean, default: lazy { secret || secret_path }
40
+ property :encrypt, Boolean, default: lazy {
41
+ if secret.nil? && secret_path.nil?
42
+ false
43
+ else
44
+ true
45
+ end
46
+ }
41
47
  property :secret, String
42
48
  property :secret_path, String
43
49
  property :encryption_version, Integer
@@ -165,8 +171,8 @@ class Chef
165
171
 
166
172
  # There are no encryptable values, so pretend encryption is the same as desired
167
173
 
168
- current_resource.encrypt new_resource.encrypt
169
- current_resource.encryption_version new_resource.encryption_version
174
+ current_resource.encrypt(new_resource.encrypt) unless new_resource.encrypt.nil?
175
+ current_resource.encryption_version(new_resource.encryption_version) if new_resource.encryption_version
170
176
  if new_resource.secret || new_resource.secret_path
171
177
  current_resource.secret new_secret
172
178
  end
@@ -239,11 +239,11 @@ class Chef
239
239
  if key
240
240
  @current_private_key = key
241
241
  resource.format key_format[:format]
242
- resource.type key_format[:type]
243
- resource.size key_format[:size]
244
- resource.exponent key_format[:exponent]
245
- resource.pass_phrase key_format[:pass_phrase]
246
- resource.cipher key_format[:cipher]
242
+ resource.type(key_format[:type]) if key_format[:type]
243
+ resource.size(key_format[:size]) if key_format[:size]
244
+ resource.exponent(key_format[:exponent]) if key_format[:exponent]
245
+ resource.pass_phrase(key_format[:pass_phrase]) if key_format[:pass_phrase]
246
+ resource.cipher(key_format[:cipher]) if key_format[:cipher]
247
247
  end
248
248
  rescue
249
249
  # If there's an error reading, we assume format and type are wrong and don't futz with them
@@ -23,7 +23,7 @@ module Cheffish
23
23
  end
24
24
  end
25
25
 
26
- key_format[:type] = type_of(key)
26
+ key_format[:type] = type_of(key) if type_of(key)
27
27
  key_format[:size] = size_of(key) if size_of(key)
28
28
  key_format[:pass_phrase] = pass_phrase if pass_phrase
29
29
  # TODO cipher, exponent
@@ -94,19 +94,21 @@ module Cheffish
94
94
 
95
95
  def self.type_of(key)
96
96
  case key.class
97
- when OpenSSL::PKey::RSA
98
- :rsa
99
- when OpenSSL::PKey::DSA
100
- :dsa
97
+ when OpenSSL::PKey::RSA
98
+ :rsa
99
+ when OpenSSL::PKey::DSA
100
+ :dsa
101
+ else
102
+ nil
101
103
  end
102
104
  end
103
105
 
104
106
  def self.size_of(key)
105
107
  case key.class
106
- when OpenSSL::PKey::RSA
107
- key.n.num_bytes * 8
108
- else
109
- nil
108
+ when OpenSSL::PKey::RSA
109
+ key.n.num_bytes * 8
110
+ else
111
+ nil
110
112
  end
111
113
  end
112
114
  end
@@ -1,3 +1,3 @@
1
1
  module Cheffish
2
- VERSION = '2.0.4'
2
+ VERSION = '2.0.5'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cheffish
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.4
4
+ version: 2.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Keiser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-14 00:00:00.000000000 Z
11
+ date: 2016-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef-zero
@@ -144,7 +144,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
144
144
  version: '0'
145
145
  requirements: []
146
146
  rubyforge_project:
147
- rubygems_version: 2.4.5.1
147
+ rubygems_version: 2.5.1
148
148
  signing_key:
149
149
  specification_version: 4
150
150
  summary: A library to manipulate Chef in Chef.