cheffish 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/chef/provider/private_key.rb +11 -3
- data/lib/cheffish/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: c768248960ee1fe2711d0207f64fe5490d2954f7
|
4
|
+
data.tar.gz: 4afe8736f72242618444b6cccfc7445332951551
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 40cd6c19536b07623598b3e65cf6a5ddb710484c034dcc024f57905f03c1fb19f475bcc6dd93834b6e4adaee0e25efcd8376451c42fee8edd10140518e2b2e8c
|
7
|
+
data.tar.gz: 7f88593e7f4fb9b7473cb24a7ff9a4242a7f497778785cfc608e695c84e4f21624a88ea71adea2ba86cf957adba1c3aa72c83c70d8fe631f4499c7adef84f4c2
|
@@ -49,7 +49,7 @@ class Chef::Provider::PrivateKey < Chef::Provider::LWRPBase
|
|
49
49
|
(new_resource.regenerate_if_different &&
|
50
50
|
(current_resource.size != new_resource.size ||
|
51
51
|
current_resource.type != new_resource.type))
|
52
|
-
action = (current_resource.
|
52
|
+
action = (Array(current_resource.action) == [ :delete ]) ? "create" : "overwrite"
|
53
53
|
converge_by "#{action} #{new_resource.type} private key #{new_resource.path} (#{new_resource.size} bits#{new_resource.pass_phrase ? ", #{new_resource.cipher} password" : ""})" do
|
54
54
|
case new_resource.type
|
55
55
|
when :rsa
|
@@ -80,6 +80,11 @@ class Chef::Provider::PrivateKey < Chef::Provider::LWRPBase
|
|
80
80
|
converge_by "change format of #{new_resource.type} private key #{new_resource.path} from #{current_resource.format} to #{new_resource.format}" do
|
81
81
|
write_private_key(current_private_key)
|
82
82
|
end
|
83
|
+
elsif (@current_file_mode & 0077) != 0
|
84
|
+
new_mode = @current_file_mode & 07700
|
85
|
+
converge_by "change mode of private key #{new_resource.path} to #{new_mode.to_s(8)}" do
|
86
|
+
::File.chmod(new_mode, new_resource.path)
|
87
|
+
end
|
83
88
|
end
|
84
89
|
end
|
85
90
|
end
|
@@ -109,8 +114,10 @@ class Chef::Provider::PrivateKey < Chef::Provider::LWRPBase
|
|
109
114
|
end
|
110
115
|
|
111
116
|
def write_private_key(key)
|
112
|
-
|
113
|
-
|
117
|
+
::File.open(new_resource.path, 'w') do |file|
|
118
|
+
file.chmod(0600)
|
119
|
+
file.write(encode_private_key(key))
|
120
|
+
end
|
114
121
|
end
|
115
122
|
|
116
123
|
def new_source_key
|
@@ -148,6 +155,7 @@ class Chef::Provider::PrivateKey < Chef::Provider::LWRPBase
|
|
148
155
|
resource.pass_phrase key_format[:pass_phrase]
|
149
156
|
resource.cipher key_format[:cipher]
|
150
157
|
end
|
158
|
+
@current_file_mode = ::File.stat(new_resource.path).mode
|
151
159
|
rescue
|
152
160
|
# If there's an error reading, we assume format and type are wrong and don't futz with them
|
153
161
|
end
|
data/lib/cheffish/version.rb
CHANGED
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: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Keiser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-04-
|
11
|
+
date: 2014-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chef
|