hiera-eyaml 1.1.3 → 1.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -51,6 +51,18 @@ This creates a public and private key with default names in the default location
51
51
  $ eyaml -e -s text # Encrypt some text
52
52
  $ eyaml -e -p # Encrypt a password (prompt for it)
53
53
 
54
+ You can also specify the name of the value and the output style (block or string) so that you can
55
+ redirect the output directly to a file:
56
+
57
+ $ eyaml -e -n my-secret -s "Secret Text" -o block
58
+
59
+ returns:
60
+
61
+ $ my-secret: >
62
+ $ ENC[...
63
+ $ .......
64
+ $ ......]
65
+
54
66
  ### Decryption
55
67
 
56
68
  To decrypt something, you need the public_key and the private_key on the puppet master.
data/bin/eyaml CHANGED
@@ -107,7 +107,8 @@ Usage:
107
107
  opt :string, "Encrypt a string provided on the command line", :short => 's', :type => :string
108
108
  opt :private_key, "Filename of the private_key", :type => :string, :default => "/etc/hiera/keys/private_key.pem"
109
109
  opt :public_key, "Filename of the public_key", :type => :string, :default => "/etc/hiera/keys/public_key.pem"
110
- opt :output, "Output mode to use when encrypting (examples, block or string)", :type => :string, :default => "examples"
110
+ opt :output, "Output mode to use when encrypting (examples, block or string)", :short => 'o', :type => :string, :default => "examples"
111
+ opt :name, "Add the name for the eyaml key (example, myvar: )", :short => 'n', :type => :string
111
112
  end
112
113
 
113
114
  main_option_count = 0
@@ -191,7 +192,7 @@ if options[:eyaml]
191
192
 
192
193
  eyaml = get_file_input options
193
194
  cipher_eyaml = encrypt_yaml(public_key, eyaml)
194
-
195
+
195
196
  puts eyaml
196
197
  exit
197
198
  end
@@ -214,13 +215,31 @@ else
214
215
 
215
216
  case options[:output]
216
217
  when "examples"
218
+ if options[:name].nil?
217
219
  puts "string: ENC[#{ciphertext_as_string}]\n\nOR\n\n"
218
220
  puts "block: >"
219
221
  puts " ENC[" + ciphertext_as_block.gsub(/\n/, "\n ") + "]"
222
+ else
223
+ puts options[:name] + ": ENC[#{ciphertext_as_string}]\n\nOR\n\n"
224
+ puts options[:name] +": >"
225
+ puts " ENC[" + ciphertext_as_block.gsub(/\n/, "\n ") + "]"
226
+ puts
227
+ end
220
228
  when "block"
229
+ if options[:name].nil?
221
230
  puts "ENC[" + ciphertext_as_block + "]"
231
+ else
232
+ puts options[:name] + ": >"
233
+ puts " ENC[" + ciphertext_as_block.gsub(/\n/, "\n ") + "]"
234
+ puts
235
+ end
222
236
  when "string"
237
+ if options[:name].nil?
223
238
  puts "ENC[#{ciphertext_as_string}]"
239
+ else
240
+ puts options[:name] + ": ENC[#{ciphertext_as_string}]"
241
+ puts
242
+ end
224
243
  else
225
244
  $stderr.puts "Unknown output option: " + options[:output]
226
245
  exit 1
@@ -1,7 +1,7 @@
1
1
  module Hiera
2
2
  module Backend
3
3
  module Eyaml
4
- VERSION = "1.1.3"
4
+ VERSION = "1.1.4"
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hiera-eyaml
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-07-22 00:00:00.000000000 Z
12
+ date: 2013-07-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: trollop