yaml_recrypt 0.1.1 → 0.1.2
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/exe/yaml_recrypt +2 -2
- data/lib/yaml_recrypt.rb +13 -8
- data/lib/yaml_recrypt/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: f16d4e879ea73da0905ca4dbb84722491a8bfaf4
|
4
|
+
data.tar.gz: 97c6b54e0bdb44b94977e29968a624e646ad1364
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 584f03df9db3301acef41bb8efb9917fb70f45669257828c863f27ed808e61c768cb675f81ca8e0ff0a8c5ee9cf3c04ad0887c85bc9b8588e63c5dcd7f8fd516
|
7
|
+
data.tar.gz: b65779783c65631418d3503f25c76f9b132d7240eefa3b00c62057cffd663f9d0abe0382a2a560c899f91f908f2dbd18942c8123aeef81a99582646fa37724e2
|
data/README.md
CHANGED
@@ -29,7 +29,7 @@ To do this, `yaml_recrypt` needs:
|
|
29
29
|
* Your GPG PKI (directory of gpg keychains, etc - usually at `~/.gpg`)
|
30
30
|
* Your hiera-eyaml public key (usually at `/etc/puppetlabs/puppet/keys`)
|
31
31
|
|
32
|
-
`yaml_recrypt` should not be run inside the `/etc/puppet*` directory to avoid the risk of updating files which are currently in use. Ideally, data should be copied off the puppet server for
|
32
|
+
`yaml_recrypt` should not be run inside the `/etc/puppet*` directory to avoid the risk of updating files which are currently in use. Ideally, data should be copied off the puppet server for re-encryption (eg a workstation - must be running Linux) as:
|
33
33
|
* This prevents altering the `gems` installed on the production master
|
34
34
|
* The conversion can be done in a safe and controlled environment
|
35
35
|
* Files can be easilty deleted afterwards
|
data/exe/yaml_recrypt
CHANGED
@@ -5,7 +5,7 @@ require 'yaml_recrypt/version'
|
|
5
5
|
|
6
6
|
# help message if nothing selected
|
7
7
|
if ARGV.size == 0
|
8
|
-
ARGV.unshift('help')
|
8
|
+
ARGV.unshift('--help')
|
9
9
|
end
|
10
10
|
Escort::App.create do |app|
|
11
11
|
app.version YamlRecrypt::VERSION
|
@@ -30,7 +30,7 @@ Escort::App.create do |app|
|
|
30
30
|
eyaml_pub_key = options[:global][:commands][:convert][:options][:eyaml_pub_key]
|
31
31
|
gpg_home = options[:global][:commands][:convert][:options][:gpg_home]
|
32
32
|
if eyaml_pub_key == nil or gpg_home == nil
|
33
|
-
raise "Both --eyaml-pub-key and --gpg-
|
33
|
+
raise "Both --eyaml-pub-key and --gpg-home must be specified"
|
34
34
|
else
|
35
35
|
puts YamlRecrypt::recrypt_r(Dir.pwd, gpg_home, eyaml_pub_key)
|
36
36
|
end
|
data/lib/yaml_recrypt.rb
CHANGED
@@ -45,18 +45,23 @@ module YamlRecrypt
|
|
45
45
|
def self.descend(gpg_home, eyaml_pub_key, value)
|
46
46
|
replaced = 0
|
47
47
|
if value.class == Array
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
48
|
+
i = 0
|
49
|
+
value.each { |v|
|
50
|
+
begin
|
51
|
+
r, subtree = descend(gpg_home, eyaml_pub_key, v)
|
52
|
+
value[i] = subtree
|
53
|
+
replaced += r
|
54
|
+
rescue GPGME::Error::NoData
|
55
|
+
raise("Invalid GPG data detected in element #{i}")
|
56
|
+
end
|
57
|
+
i += 1
|
53
58
|
}
|
54
59
|
elsif value.class == Hash
|
55
60
|
value.each { |k,v|
|
56
61
|
begin
|
57
|
-
r, subtree
|
58
|
-
value[k]
|
59
|
-
replaced
|
62
|
+
r, subtree = descend(gpg_home, eyaml_pub_key, v)
|
63
|
+
value[k] = subtree
|
64
|
+
replaced += r
|
60
65
|
rescue GPGME::Error::NoData
|
61
66
|
raise("Invalid GPG data detected in key #{k}")
|
62
67
|
end
|
data/lib/yaml_recrypt/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yaml_recrypt
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Geoff Williams
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-04-
|
11
|
+
date: 2017-04-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|