yaml_recrypt 0.1.1 → 0.1.2

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: 706a7b37ab2e8fa258932696bf423a90eff36ba5
4
- data.tar.gz: 3e98b9b601e5174e2406e5741463d34f7a9e6668
3
+ metadata.gz: f16d4e879ea73da0905ca4dbb84722491a8bfaf4
4
+ data.tar.gz: 97c6b54e0bdb44b94977e29968a624e646ad1364
5
5
  SHA512:
6
- metadata.gz: 9ba6efca12ddc88d3e81938232eed6e367602937e8bf7f4add01e25ab18be6a02366b485e547c00f3abe4c785ae674942442dce71e56a4754dfe2ea9bf199d1c
7
- data.tar.gz: c81e67c223ab326fb5c5fc4f336794a92432831cd6334bae3849806b0e519a05595d8608bae310eec979bcc2d89b3c96d5b33eb5c84ad80d325fa7d427e137d4
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 rencryption (eg a workstation - must be running Linux) as:
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-private-key must be specified"
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
- value = value.map { |e|
49
- r, newvalue = process_value(e, gpg_home, eyaml_pub_key)
50
- replaced += r
51
-
52
- newvalue
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 = descend(gpg_home, eyaml_pub_key, v)
58
- value[k] = subtree
59
- replaced += r
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
@@ -1,3 +1,3 @@
1
1
  module YamlRecrypt
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
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.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-12 00:00:00.000000000 Z
11
+ date: 2017-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler