hiera-eyaml-cli 0.1 → 0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4a32e3cb7f30cf2938a0c2f26e363032eae49c72eb6deedcfd7365502e3806f9
4
- data.tar.gz: 8de78fbac96d6f0058c5bc6156d2356ae95ba18a0fdcf9d24a3e8fd13cf46a04
3
+ metadata.gz: 991556c46821c35532265701859a6edfb8362e298c93a28c035fb2b4b2e1baf8
4
+ data.tar.gz: dac9fa2afbce6fdcb2cf21a0e31cda4364ee9994e8d29bb307ce2f1ac9f16aa9
5
5
  SHA512:
6
- metadata.gz: ef91f58cbf75d55430847dc793833df17af09d37cafd8956588bf1fb40b450c37c6a45bf7ee25d93c4f0751a9a9dd44c4f9f2958bc83673c0214e35d7138b78b
7
- data.tar.gz: 04617d1bfb936512aff658465e3e81b2971d5a9bcde3f59343af6c669600caf8aa13c1bbc5be850c834329a3e0593faacf645c7ad9219593a39f6a0e38553f37
6
+ metadata.gz: d45fd488d535621545ee1c1f295d6c740b35d8ddc7ead123417f071d469b428dc0b97c0abd46a514acec9f28c26f98801dbba66b03b9c35846cacd29be76c3ba
7
+ data.tar.gz: 7459500daad9cc90063712c2652929328946efaa857a7a907aea1021f58e237ebef9fbe0f66447c7bad2e24b3444c97f1d14ee6e833c072adad649cb24d634b1
@@ -0,0 +1,3 @@
1
+ # hiera-eyaml-cli
2
+
3
+ Use a cli command to encrypt data for `hiera-eyaml`.
@@ -15,6 +15,10 @@ class Hiera
15
15
  decrypt_command: {
16
16
  desc: 'Command to run to decrypt data (takes data on stdin)',
17
17
  type: :string
18
+ },
19
+ stderr: {
20
+ desc: 'Capture stderr on command output',
21
+ type: :bool
18
22
  }
19
23
  }
20
24
 
@@ -35,8 +39,20 @@ class Hiera
35
39
  decrypt_command
36
40
  end
37
41
 
42
+ def self.stderr
43
+ stderr = option :stderr
44
+ if stderr.nil? || stderr.empty?
45
+ stderr = false
46
+ end
47
+ stderr
48
+ end
49
+
38
50
  def self.encrypt(plaintext)
39
- out, status = Open3.capture2(self.encrypt_command, :stdin_data=>plaintext)
51
+ if self.stderr
52
+ out, status = Open3.capture2(self.encrypt_command, :stdin_data=>plaintext)
53
+ else
54
+ out, err, status = Open3.capture3(self.encrypt_command, :stdin_data=>plaintext)
55
+ end
40
56
  if status != 0
41
57
  raise 'Call to encrypt subcommand failed'
42
58
  end
@@ -44,7 +60,11 @@ class Hiera
44
60
  end
45
61
 
46
62
  def self.decrypt(ciphertext)
47
- out, status = Open3.capture2(self.decrypt_command, :stdin_data=>ciphertext)
63
+ if self.stderr
64
+ out, status = Open3.capture2(self.decrypt_command, :stdin_data=>ciphertext)
65
+ else
66
+ out, err, status = Open3.capture3(self.decrypt_command, :stdin_data=>ciphertext)
67
+ end
48
68
  if status != 0
49
69
  raise 'Call to decrypt subcommand failed'
50
70
  end
@@ -0,0 +1,11 @@
1
+ class Hiera
2
+ module Backend
3
+ module Eyaml
4
+ module Encryptors
5
+ module Cli
6
+ VERSION = '0.2'.freeze
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hiera-eyaml-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: '0.1'
4
+ version: '0.2'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ethan Smith
@@ -34,9 +34,11 @@ files:
34
34
  - ".rubocop.yml"
35
35
  - Gemfile
36
36
  - LICENSE
37
+ - README.md
37
38
  - hiera-eyaml-cli.gemspec
38
39
  - lib/hiera/backend/eyaml/encryptors/cli.rb
39
40
  - lib/hiera/backend/eyaml/encryptors/cli/eyaml_init.rb
41
+ - lib/hiera/backend/eyaml/encryptors/cli/version.rb
40
42
  homepage: http://github.com/ethanhs/hiera-eyaml-cli
41
43
  licenses:
42
44
  - MIT