chef 11.8.4.ohai7.0 → 11.10.0.alpha.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (134) hide show
  1. checksums.yaml +7 -0
  2. data/distro/common/html/chef-client.8.html +3 -3
  3. data/distro/common/html/chef-expander.8.html +3 -3
  4. data/distro/common/html/chef-expanderctl.8.html +3 -3
  5. data/distro/common/html/chef-server-webui.8.html +3 -3
  6. data/distro/common/html/chef-server.8.html +3 -3
  7. data/distro/common/html/chef-shell.1.html +3 -3
  8. data/distro/common/html/chef-solo.8.html +3 -3
  9. data/distro/common/html/chef-solr.8.html +4 -4
  10. data/distro/common/html/knife-bootstrap.1.html +3 -3
  11. data/distro/common/html/knife-client.1.html +3 -3
  12. data/distro/common/html/knife-configure.1.html +3 -3
  13. data/distro/common/html/knife-cookbook-site.1.html +3 -3
  14. data/distro/common/html/knife-cookbook.1.html +3 -3
  15. data/distro/common/html/knife-data-bag.1.html +3 -3
  16. data/distro/common/html/knife-environment.1.html +3 -3
  17. data/distro/common/html/knife-exec.1.html +3 -3
  18. data/distro/common/html/knife-index.1.html +3 -3
  19. data/distro/common/html/knife-node.1.html +3 -3
  20. data/distro/common/html/knife-role.1.html +3 -3
  21. data/distro/common/html/knife-search.1.html +3 -3
  22. data/distro/common/html/knife-ssh.1.html +3 -3
  23. data/distro/common/html/knife-status.1.html +3 -3
  24. data/distro/common/html/knife-tag.1.html +3 -3
  25. data/distro/common/html/knife.1.html +3 -3
  26. data/distro/common/man/man8/chef-client.8 +3 -3
  27. data/distro/common/man/man8/chef-solo.8 +5 -2
  28. data/lib/chef.rb +2 -0
  29. data/lib/chef/application.rb +7 -2
  30. data/lib/chef/application/apply.rb +6 -0
  31. data/lib/chef/application/client.rb +3 -1
  32. data/lib/chef/application/knife.rb +2 -0
  33. data/lib/chef/application/solo.rb +1 -1
  34. data/lib/chef/client.rb +14 -11
  35. data/lib/chef/config.rb +4 -1
  36. data/lib/chef/cookbook_uploader.rb +14 -7
  37. data/lib/chef/encrypted_data_bag_item.rb +6 -303
  38. data/lib/chef/encrypted_data_bag_item/decryption_failure.rb +22 -0
  39. data/lib/chef/encrypted_data_bag_item/decryptor.rb +201 -0
  40. data/lib/chef/encrypted_data_bag_item/encryptor.rb +142 -0
  41. data/lib/chef/encrypted_data_bag_item/unacceptable_encrypted_data_bag_item_format.rb +22 -0
  42. data/lib/chef/encrypted_data_bag_item/unsupported_cipher.rb +22 -0
  43. data/lib/chef/encrypted_data_bag_item/unsupported_encrypted_data_bag_item_format.rb +22 -0
  44. data/lib/chef/exceptions.rb +1 -0
  45. data/lib/chef/formatters/doc.rb +19 -3
  46. data/lib/chef/http/basic_client.rb +1 -1
  47. data/lib/chef/http/http_request.rb +7 -0
  48. data/lib/chef/knife.rb +8 -1
  49. data/lib/chef/knife/bootstrap.rb +1 -1
  50. data/lib/chef/knife/cookbook_site_share.rb +2 -2
  51. data/lib/chef/knife/cookbook_upload.rb +7 -1
  52. data/lib/chef/knife/core/subcommand_loader.rb +2 -2
  53. data/lib/chef/knife/data_bag_create.rb +7 -0
  54. data/lib/chef/knife/environment_compare.rb +127 -0
  55. data/lib/chef/mixin/command.rb +11 -12
  56. data/lib/chef/mixin/deep_merge.rb +4 -4
  57. data/lib/chef/monkey_patches/net_http.rb +34 -0
  58. data/lib/chef/monkey_patches/uri.rb +70 -0
  59. data/lib/chef/platform/provider_mapping.rb +1 -0
  60. data/lib/chef/provider/cookbook_file.rb +8 -0
  61. data/lib/chef/provider/cron.rb +1 -1
  62. data/lib/chef/provider/directory.rb +7 -0
  63. data/lib/chef/provider/file.rb +17 -4
  64. data/lib/chef/provider/git.rb +23 -5
  65. data/lib/chef/provider/group.rb +30 -11
  66. data/lib/chef/provider/group/dscl.rb +26 -4
  67. data/lib/chef/provider/group/gpasswd.rb +14 -19
  68. data/lib/chef/provider/group/groupadd.rb +41 -1
  69. data/lib/chef/provider/group/groupmod.rb +46 -36
  70. data/lib/chef/provider/group/pw.rb +59 -16
  71. data/lib/chef/provider/group/suse.rb +16 -13
  72. data/lib/chef/provider/group/usermod.rb +38 -15
  73. data/lib/chef/provider/group/windows.rb +13 -6
  74. data/lib/chef/provider/ohai.rb +5 -6
  75. data/lib/chef/provider/remote_file.rb +8 -0
  76. data/lib/chef/provider/template.rb +8 -0
  77. data/lib/chef/provider/user.rb +5 -1
  78. data/lib/chef/provider/user/useradd.rb +7 -0
  79. data/lib/chef/provider/whyrun_safe_ruby_block.rb +30 -0
  80. data/lib/chef/providers.rb +1 -0
  81. data/lib/chef/resource/deploy.rb +18 -0
  82. data/lib/chef/resource/group.rb +11 -0
  83. data/lib/chef/resource/scm.rb +18 -0
  84. data/lib/chef/resource/whyrun_safe_ruby_block.rb +31 -0
  85. data/lib/chef/resources.rb +1 -0
  86. data/lib/chef/run_context.rb +11 -0
  87. data/lib/chef/shell/ext.rb +1 -1
  88. data/lib/chef/util/windows/net_group.rb +5 -1
  89. data/lib/chef/version.rb +1 -1
  90. data/spec/functional/resource/base.rb +3 -1
  91. data/spec/functional/resource/deploy_revision_spec.rb +1 -1
  92. data/spec/functional/resource/git_spec.rb +1 -1
  93. data/spec/functional/resource/group_spec.rb +257 -118
  94. data/spec/integration/client/client_spec.rb +82 -8
  95. data/spec/integration/client/ipv6_spec.rb +133 -0
  96. data/spec/integration/knife/cookbook_api_ipv6_spec.rb +111 -0
  97. data/spec/scripts/ssl-serve.rb +52 -0
  98. data/spec/spec_helper.rb +7 -6
  99. data/spec/support/platform_helpers.rb +21 -0
  100. data/spec/support/shared/functional/windows_script.rb +2 -1
  101. data/spec/support/shared/unit/provider/file.rb +181 -43
  102. data/spec/support/shared/unit/provider/useradd_based_user_provider.rb +18 -0
  103. data/spec/unit/application/client_spec.rb +1 -0
  104. data/spec/unit/client_spec.rb +14 -1
  105. data/spec/unit/config_spec.rb +20 -0
  106. data/spec/unit/encrypted_data_bag_item_spec.rb +32 -18
  107. data/spec/unit/knife/cookbook_upload_spec.rb +14 -0
  108. data/spec/unit/knife/core/subcommand_loader_spec.rb +2 -2
  109. data/spec/unit/knife/data_bag_create_spec.rb +7 -0
  110. data/spec/unit/knife/environment_compare_spec.rb +112 -0
  111. data/spec/unit/knife_spec.rb +6 -1
  112. data/spec/unit/monkey_patches/uri_spec.rb +34 -0
  113. data/spec/unit/provider/cookbook_file_spec.rb +2 -1
  114. data/spec/unit/provider/cron_spec.rb +6 -0
  115. data/spec/unit/provider/file_spec.rb +3 -1
  116. data/spec/unit/provider/git_spec.rb +28 -4
  117. data/spec/unit/provider/group/dscl_spec.rb +1 -0
  118. data/spec/unit/provider/group/gpasswd_spec.rb +16 -9
  119. data/spec/unit/provider/group/groupadd_spec.rb +3 -4
  120. data/spec/unit/provider/group/groupmod_spec.rb +0 -1
  121. data/spec/unit/provider/group/pw_spec.rb +11 -14
  122. data/spec/unit/provider/group/usermod_spec.rb +19 -4
  123. data/spec/unit/provider/group/windows_spec.rb +0 -8
  124. data/spec/unit/provider/group_spec.rb +26 -4
  125. data/spec/unit/provider/ohai_spec.rb +1 -0
  126. data/spec/unit/provider/remote_file_spec.rb +4 -3
  127. data/spec/unit/provider/template_spec.rb +5 -3
  128. data/spec/unit/provider/user_spec.rb +6 -0
  129. data/spec/unit/provider/whyrun_safe_ruby_block_spec.rb +47 -0
  130. data/spec/unit/resource/scm_spec.rb +10 -0
  131. data/spec/unit/rest/auth_credentials_spec.rb +4 -1
  132. data/spec/unit/rest_spec.rb +12 -3
  133. metadata +69 -97
  134. data/spec/functional/resource/ohai_spec.rb +0 -65
@@ -0,0 +1,22 @@
1
+ #
2
+ # Author:: Seth Falcon (<seth@opscode.com>)
3
+ # Copyright:: Copyright 2010-2011 Opscode, Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ class Chef::EncryptedDataBagItem
20
+ class DecryptionFailure < StandardError
21
+ end
22
+ end
@@ -0,0 +1,201 @@
1
+ #
2
+ # Author:: Seth Falcon (<seth@opscode.com>)
3
+ # Copyright:: Copyright 2010-2011 Opscode, Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ require 'yaml'
20
+ require 'yajl'
21
+ require 'openssl'
22
+ require 'base64'
23
+ require 'digest/sha2'
24
+ require 'chef/encrypted_data_bag_item'
25
+ require 'chef/encrypted_data_bag_item/unsupported_encrypted_data_bag_item_format'
26
+ require 'chef/encrypted_data_bag_item/unacceptable_encrypted_data_bag_item_format'
27
+ require 'chef/encrypted_data_bag_item/decryption_failure'
28
+ require 'chef/encrypted_data_bag_item/unsupported_cipher'
29
+
30
+ class Chef::EncryptedDataBagItem
31
+
32
+ #=== Decryptor
33
+ # For backwards compatibility, Chef implements decryption/deserialization for
34
+ # older encrypted data bag item formats in addition to the current version.
35
+ # Each decryption/deserialization strategy is implemented as a class in this
36
+ # namespace. For convenience the factory method +Decryptor.for()+ can be used
37
+ # to create an instance of the appropriate strategy for the given encrypted
38
+ # data bag value.
39
+ module Decryptor
40
+
41
+ # Detects the encrypted data bag item format version and instantiates a
42
+ # decryptor object for that version. Call #for_decrypted_item on the
43
+ # resulting object to decrypt and deserialize it.
44
+ def self.for(encrypted_value, key)
45
+ format_version = format_version_of(encrypted_value)
46
+ assert_format_version_acceptable!(format_version)
47
+ case format_version
48
+ when 2
49
+ Version2Decryptor.new(encrypted_value, key)
50
+ when 1
51
+ Version1Decryptor.new(encrypted_value, key)
52
+ when 0
53
+ Version0Decryptor.new(encrypted_value, key)
54
+ else
55
+ raise UnsupportedEncryptedDataBagItemFormat,
56
+ "This version of chef does not support encrypted data bag item format version '#{format_version}'"
57
+ end
58
+ end
59
+
60
+ def self.format_version_of(encrypted_value)
61
+ if encrypted_value.respond_to?(:key?)
62
+ encrypted_value["version"]
63
+ else
64
+ 0
65
+ end
66
+ end
67
+
68
+ def self.assert_format_version_acceptable!(format_version)
69
+ unless format_version.kind_of?(Integer) and format_version >= Chef::Config[:data_bag_decrypt_minimum_version]
70
+ raise UnacceptableEncryptedDataBagItemFormat,
71
+ "The encrypted data bag item has format version `#{format_version}', " +
72
+ "but the config setting 'data_bag_decrypt_minimum_version' requires version `#{Chef::Config[:data_bag_decrypt_minimum_version]}'"
73
+ end
74
+ end
75
+
76
+ class Version0Decryptor
77
+
78
+ attr_reader :encrypted_data
79
+ attr_reader :key
80
+
81
+ def initialize(encrypted_data, key)
82
+ @encrypted_data = encrypted_data
83
+ @key = key
84
+ end
85
+
86
+ def for_decrypted_item
87
+ YAML.load(decrypted_data)
88
+ end
89
+
90
+ def decrypted_data
91
+ @decrypted_data ||= begin
92
+ plaintext = openssl_decryptor.update(encrypted_bytes)
93
+ plaintext << openssl_decryptor.final
94
+ rescue OpenSSL::Cipher::CipherError => e
95
+ raise DecryptionFailure, "Error decrypting data bag value: '#{e.message}'. Most likely the provided key is incorrect"
96
+ end
97
+ end
98
+
99
+ def encrypted_bytes
100
+ Base64.decode64(@encrypted_data)
101
+ end
102
+
103
+ def openssl_decryptor
104
+ @openssl_decryptor ||= begin
105
+ d = OpenSSL::Cipher::Cipher.new(ALGORITHM)
106
+ d.decrypt
107
+ d.pkcs5_keyivgen(key)
108
+ d
109
+ end
110
+ end
111
+ end
112
+
113
+ class Version1Decryptor
114
+
115
+ attr_reader :encrypted_data
116
+ attr_reader :key
117
+
118
+ def initialize(encrypted_data, key)
119
+ @encrypted_data = encrypted_data
120
+ @key = key
121
+ end
122
+
123
+ def for_decrypted_item
124
+ Yajl::Parser.parse(decrypted_data)["json_wrapper"]
125
+ rescue Yajl::ParseError
126
+ # convert to a DecryptionFailure error because the most likely scenario
127
+ # here is that the decryption step was unsuccessful but returned bad
128
+ # data rather than raising an error.
129
+ raise DecryptionFailure, "Error decrypting data bag value. Most likely the provided key is incorrect"
130
+ end
131
+
132
+ def encrypted_bytes
133
+ Base64.decode64(@encrypted_data["encrypted_data"])
134
+ end
135
+
136
+ def iv
137
+ Base64.decode64(@encrypted_data["iv"])
138
+ end
139
+
140
+ def decrypted_data
141
+ @decrypted_data ||= begin
142
+ plaintext = openssl_decryptor.update(encrypted_bytes)
143
+ plaintext << openssl_decryptor.final
144
+ rescue OpenSSL::Cipher::CipherError => e
145
+ raise DecryptionFailure, "Error decrypting data bag value: '#{e.message}'. Most likely the provided key is incorrect"
146
+ end
147
+ end
148
+
149
+ def openssl_decryptor
150
+ @openssl_decryptor ||= begin
151
+ assert_valid_cipher!
152
+ d = OpenSSL::Cipher::Cipher.new(ALGORITHM)
153
+ d.decrypt
154
+ d.key = Digest::SHA256.digest(key)
155
+ d.iv = iv
156
+ d
157
+ end
158
+ end
159
+
160
+ def assert_valid_cipher!
161
+ # In the future, chef may support configurable ciphers. For now, only
162
+ # aes-256-cbc is supported.
163
+ requested_cipher = @encrypted_data["cipher"]
164
+ unless requested_cipher == ALGORITHM
165
+ raise UnsupportedCipher,
166
+ "Cipher '#{requested_cipher}' is not supported by this version of Chef. Available ciphers: ['#{ALGORITHM}']"
167
+ end
168
+ end
169
+ end
170
+
171
+ class Version2Decryptor < Version1Decryptor
172
+
173
+ def decrypted_data
174
+ validate_hmac! unless @decrypted_data
175
+ super
176
+ end
177
+
178
+ def validate_hmac!
179
+ digest = OpenSSL::Digest::Digest.new("sha256")
180
+ raw_hmac = OpenSSL::HMAC.digest(digest, key, @encrypted_data["encrypted_data"])
181
+
182
+ if candidate_hmac_matches?(raw_hmac)
183
+ true
184
+ else
185
+ raise DecryptionFailure, "Error decrypting data bag value: invalid hmac. Most likely the provided key is incorrect"
186
+ end
187
+ end
188
+
189
+ private
190
+
191
+ def candidate_hmac_matches?(expected_hmac)
192
+ return false unless @encrypted_data["hmac"]
193
+ expected_bytes = expected_hmac.bytes.to_a
194
+ candidate_hmac_bytes = Base64.decode64(@encrypted_data["hmac"]).bytes.to_a
195
+ valid = expected_bytes.size ^ candidate_hmac_bytes.size
196
+ expected_bytes.zip(candidate_hmac_bytes) { |x, y| valid |= x ^ y.to_i }
197
+ valid == 0
198
+ end
199
+ end
200
+ end
201
+ end
@@ -0,0 +1,142 @@
1
+ #
2
+ # Author:: Seth Falcon (<seth@opscode.com>)
3
+ # Copyright:: Copyright 2010-2011 Opscode, Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ require 'base64'
20
+ require 'digest/sha2'
21
+ require 'openssl'
22
+ require 'yajl'
23
+ require 'chef/encrypted_data_bag_item'
24
+ require 'chef/encrypted_data_bag_item/unsupported_encrypted_data_bag_item_format'
25
+
26
+ class Chef::EncryptedDataBagItem
27
+
28
+ # Implementation class for converting plaintext data bag item values to an
29
+ # encrypted value, including any necessary wrappers and metadata.
30
+ module Encryptor
31
+
32
+ # "factory" method that creates an encryptor object with the proper class
33
+ # for the desired encrypted data bag format version.
34
+ #
35
+ # +Chef::Config[:data_bag_encrypt_version]+ determines which version is used.
36
+ def self.new(value, secret, iv=nil)
37
+ format_version = Chef::Config[:data_bag_encrypt_version]
38
+ case format_version
39
+ when 1
40
+ Version1Encryptor.new(value, secret, iv)
41
+ when 2
42
+ Version2Encryptor.new(value, secret, iv)
43
+ else
44
+ raise UnsupportedEncryptedDataBagItemFormat,
45
+ "Invalid encrypted data bag format version `#{format_version}'. Supported versions are '1', '2'"
46
+ end
47
+ end
48
+
49
+ class Version1Encryptor
50
+ attr_reader :key
51
+ attr_reader :plaintext_data
52
+
53
+ # Create a new Encryptor for +data+, which will be encrypted with the given
54
+ # +key+.
55
+ #
56
+ # === Arguments:
57
+ # * data: An object of any type that can be serialized to json
58
+ # * key: A String representing the desired passphrase
59
+ # * iv: The optional +iv+ parameter is intended for testing use only. When
60
+ # *not* supplied, Encryptor will use OpenSSL to generate a secure random
61
+ # IV, which is what you want.
62
+ def initialize(plaintext_data, key, iv=nil)
63
+ @plaintext_data = plaintext_data
64
+ @key = key
65
+ @iv = iv && Base64.decode64(iv)
66
+ end
67
+
68
+ # Returns a wrapped and encrypted version of +plaintext_data+ suitable for
69
+ # using as the value in an encrypted data bag item.
70
+ def for_encrypted_item
71
+ {
72
+ "encrypted_data" => encrypted_data,
73
+ "iv" => Base64.encode64(iv),
74
+ "version" => 1,
75
+ "cipher" => ALGORITHM
76
+ }
77
+ end
78
+
79
+ # Generates or returns the IV.
80
+ def iv
81
+ # Generated IV comes from OpenSSL::Cipher::Cipher#random_iv
82
+ # This gets generated when +openssl_encryptor+ gets created.
83
+ openssl_encryptor if @iv.nil?
84
+ @iv
85
+ end
86
+
87
+ # Generates (and memoizes) an OpenSSL::Cipher::Cipher object and configures
88
+ # it for the specified iv and encryption key.
89
+ def openssl_encryptor
90
+ @openssl_encryptor ||= begin
91
+ encryptor = OpenSSL::Cipher::Cipher.new(ALGORITHM)
92
+ encryptor.encrypt
93
+ @iv ||= encryptor.random_iv
94
+ encryptor.iv = @iv
95
+ encryptor.key = Digest::SHA256.digest(key)
96
+ encryptor
97
+ end
98
+ end
99
+
100
+ # Encrypts and Base64 encodes +serialized_data+
101
+ def encrypted_data
102
+ @encrypted_data ||= begin
103
+ enc_data = openssl_encryptor.update(serialized_data)
104
+ enc_data << openssl_encryptor.final
105
+ Base64.encode64(enc_data)
106
+ end
107
+ end
108
+
109
+ # Wraps the data in a single key Hash (JSON Object) and converts to JSON.
110
+ # The wrapper is required because we accept values (such as Integers or
111
+ # Strings) that do not produce valid JSON when serialized without the
112
+ # wrapper.
113
+ def serialized_data
114
+ Yajl::Encoder.encode(:json_wrapper => plaintext_data)
115
+ end
116
+ end
117
+
118
+ class Version2Encryptor < Version1Encryptor
119
+
120
+ # Returns a wrapped and encrypted version of +plaintext_data+ suitable for
121
+ # using as the value in an encrypted data bag item.
122
+ def for_encrypted_item
123
+ {
124
+ "encrypted_data" => encrypted_data,
125
+ "hmac" => hmac,
126
+ "iv" => Base64.encode64(iv),
127
+ "version" => 2,
128
+ "cipher" => ALGORITHM
129
+ }
130
+ end
131
+
132
+ # Generates an HMAC-SHA2-256 of the encrypted data (encrypt-then-mac)
133
+ def hmac
134
+ @hmac ||= begin
135
+ digest = OpenSSL::Digest::Digest.new("sha256")
136
+ raw_hmac = OpenSSL::HMAC.digest(digest, key, encrypted_data)
137
+ Base64.encode64(raw_hmac)
138
+ end
139
+ end
140
+ end
141
+ end
142
+ end
@@ -0,0 +1,22 @@
1
+ #
2
+ # Author:: Seth Falcon (<seth@opscode.com>)
3
+ # Copyright:: Copyright 2010-2011 Opscode, Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ class Chef::EncryptedDataBagItem
20
+ class UnacceptableEncryptedDataBagItemFormat < StandardError
21
+ end
22
+ end
@@ -0,0 +1,22 @@
1
+ #
2
+ # Author:: Seth Falcon (<seth@opscode.com>)
3
+ # Copyright:: Copyright 2010-2011 Opscode, Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ class Chef::EncryptedDataBagItem
20
+ class UnsupportedCipher < StandardError
21
+ end
22
+ end
@@ -0,0 +1,22 @@
1
+ #
2
+ # Author:: Seth Falcon (<seth@opscode.com>)
3
+ # Copyright:: Copyright 2010-2011 Opscode, Inc.
4
+ # License:: Apache License, Version 2.0
5
+ #
6
+ # Licensed under the Apache License, Version 2.0 (the "License");
7
+ # you may not use this file except in compliance with the License.
8
+ # You may obtain a copy of the License at
9
+ #
10
+ # http://www.apache.org/licenses/LICENSE-2.0
11
+ #
12
+ # Unless required by applicable law or agreed to in writing, software
13
+ # distributed under the License is distributed on an "AS IS" BASIS,
14
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ # See the License for the specific language governing permissions and
16
+ # limitations under the License.
17
+ #
18
+
19
+ class Chef::EncryptedDataBagItem
20
+ class UnsupportedEncryptedDataBagItemFormat < StandardError
21
+ end
22
+ end
@@ -77,6 +77,7 @@ class Chef
77
77
  class DsclCommandFailed < RuntimeError; end
78
78
  class UserIDNotFound < ArgumentError; end
79
79
  class GroupIDNotFound < ArgumentError; end
80
+ class ConflictingMembersInGroup < ArgumentError; end
80
81
  class InvalidResourceReference < RuntimeError; end
81
82
  class ResourceNotFound < RuntimeError; end
82
83
  class InvalidResourceSpecification < ArgumentError; end
@@ -8,31 +8,46 @@ class Chef
8
8
  # "specdoc"
9
9
  class Doc < Formatters::Base
10
10
 
11
+ attr_reader :start_time, :end_time
11
12
  cli_name(:doc)
13
+
12
14
 
13
15
  def initialize(out, err)
14
16
  super
15
17
 
16
18
  @updated_resources = 0
19
+ @up_to_date_resources = 0
20
+ @start_time = Time.now
21
+ @end_time = @start_time
22
+ end
23
+
24
+ def elapsed_time
25
+ end_time - start_time
17
26
  end
18
27
 
19
28
  def run_start(version)
20
29
  puts "Starting Chef Client, version #{version}"
21
30
  end
22
31
 
32
+ def total_resources
33
+ @up_to_date_resources + @updated_resources
34
+ end
35
+
23
36
  def run_completed(node)
37
+ @end_time = Time.now
24
38
  if Chef::Config[:why_run]
25
- puts "Chef Client finished, #{@updated_resources} resources would have been updated"
39
+ puts "Chef Client finished, #{@updated_resources}/#{total_resources} resources would have been updated"
26
40
  else
27
- puts "Chef Client finished, #{@updated_resources} resources updated"
41
+ puts "Chef Client finished, #{@updated_resources}/#{total_resources} resources updated in #{elapsed_time} seconds"
28
42
  end
29
43
  end
30
44
 
31
45
  def run_failed(exception)
46
+ @end_time = Time.now
32
47
  if Chef::Config[:why_run]
33
48
  puts "Chef Client failed. #{@updated_resources} resources would have been updated"
34
49
  else
35
- puts "Chef Client failed. #{@updated_resources} resources updated"
50
+ puts "Chef Client failed. #{@updated_resources} resources updated in #{elapsed_time} seconds"
36
51
  end
37
52
  end
38
53
 
@@ -171,6 +186,7 @@ class Chef
171
186
 
172
187
  # Called when a resource has no converge actions, e.g., it was already correct.
173
188
  def resource_up_to_date(resource, action)
189
+ @up_to_date_resources+= 1
174
190
  puts " (up to date)"
175
191
  end
176
192