knife-uploader 0.3.0 → 0.3.1

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: dc52a66d8a055b73673f4c6e6f78625cb98dcb6c
4
- data.tar.gz: 900b14fa63e8f61f8ccfa9a90c284af0d47a6da8
3
+ metadata.gz: fcc9484804ca9f66f58700ac210996a74772566d
4
+ data.tar.gz: b569f9fd687aebe8b0a391d831a6515b4fc2b790
5
5
  SHA512:
6
- metadata.gz: 320b161c6c84e1069bce5eaf7f3a2c6e6b279b19dfe0610cdaa20d8f31d84eec5e97de4f873d6a7a19cb39d74a7f9bf2a7549140c85f7c00d5bf640231cf2afe
7
- data.tar.gz: 068faafc3c9cff565defd5b0ea7153597d025677543cc61d949125c44a674a0cf1b22def248da32fc46f3b16839158bd24d990e7fb2c8f58382db9a646a267d4
6
+ metadata.gz: 0758984dea2bd60386c10be3fd3eb20c80e39bc65ed77556edd745df895a72367bb0613d57e39845bb1e88c2ae0fac60b0fc00aac66f9b5d62d87973b1886ad2
7
+ data.tar.gz: 130d96553f42d95a4760e79b90b9c4f3c63f84fd0002d3e8edec19b72f4c8d761fc95ffc29bb5a0ed2e6eba7a859f5b1116d095d0fdfa98b81475b692b3b0e04
@@ -103,16 +103,21 @@ module KnifeUploader
103
103
  end
104
104
 
105
105
  option :pattern,
106
- :short => '-p PATTERN',
107
- :long => '--pattern PATTERN',
108
- :description => 'A regular expression pattern to restrict the set of objects to ' +
106
+ short: '-p PATTERN',
107
+ long: '--pattern PATTERN',
108
+ description: 'A regular expression pattern to restrict the set of objects to ' +
109
109
  'manipulate',
110
- :proc => Proc.new { |value| Chef::Config[:knife][:pattern] = value }
110
+ proc: Proc.new { |value| Chef::Config[:knife][:pattern] = value }
111
111
 
112
112
  option :debug,
113
- :long => '--debug',
114
- :description => 'Turn on debug messages',
115
- :proc => Proc.new { |value| Chef::Config[:knife][:debug] = value }
113
+ long: '--debug',
114
+ description: 'Turn on debug messages',
115
+ proc: Proc.new { |value| Chef::Config[:knife][:debug] = value }
116
+
117
+ option :show_encrypted,
118
+ long: '--show_encrypted',
119
+ description: 'Show the decrypted data bag contets when different.',
120
+ prod: Proc.new { |value| Chef::Config[:knife][:show_encrypted] = value }
116
121
  end
117
122
  end
118
123
  end
@@ -82,6 +82,8 @@ module KnifeUploader
82
82
  old_decrypted_formatted = Utils.json_with_sorted_keys(old_decrypted)
83
83
  new_decrypted_formatted = Utils.json_with_sorted_keys(new_decrypted)
84
84
 
85
+ show_encrypted = locate_config_value(:show_encrypted) || false
86
+
85
87
  # Encrypted data could differ but decrypted data could still be the same.
86
88
  if old_decrypted_formatted == new_decrypted_formatted
87
89
  ui.info("#{item_id} has differences before decryption " +
@@ -89,10 +91,16 @@ module KnifeUploader
89
91
  return false
90
92
  end
91
93
 
92
- ui.info("#{diff_comment_prefix} data bag item #{item_id} " +
93
- "(#{old_could_decrypt ? 'decrypted' : 'raw'} #{desc1} vs." +
94
- " #{new_could_decrypt ? 'decrypted' : 'raw'} #{desc2}):\n" +
95
- diff_color(old_decrypted_formatted, new_decrypted_formatted) + "\n")
94
+ if !show_encrypted && (old_could_decrypt || new_could_decrypt)
95
+ ui.info("#{diff_comment_prefix} data bag item #{item_id}. \n" +
96
+ "\tNot showing the diff since they are encrypted.\n" +
97
+ "\tUse --show_encrypted to display the diff.\n\n")
98
+ else
99
+ ui.info("#{diff_comment_prefix} data bag item #{item_id} " +
100
+ "(#{old_could_decrypt ? 'decrypted' : 'raw'} #{desc1} vs." +
101
+ " #{new_could_decrypt ? 'decrypted' : 'raw'} #{desc2}):\n" +
102
+ diff_color(old_decrypted_formatted, new_decrypted_formatted) + "\n")
103
+ end
96
104
  true
97
105
  end
98
106
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: knife-uploader
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mikhail Bautin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-02-28 00:00:00.000000000 Z
11
+ date: 2015-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chef