chef 11.0.0.beta.0 → 11.0.0.beta.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. data/bin/chef-apply +1 -1
  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 +3 -3
  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/man1/chef-shell.1 +1 -1
  27. data/distro/common/man/man1/knife-bootstrap.1 +1 -1
  28. data/distro/common/man/man1/knife-client.1 +1 -1
  29. data/distro/common/man/man1/knife-configure.1 +1 -1
  30. data/distro/common/man/man1/knife-cookbook-site.1 +1 -1
  31. data/distro/common/man/man1/knife-cookbook.1 +1 -1
  32. data/distro/common/man/man1/knife-data-bag.1 +1 -1
  33. data/distro/common/man/man1/knife-environment.1 +1 -1
  34. data/distro/common/man/man1/knife-exec.1 +1 -1
  35. data/distro/common/man/man1/knife-index.1 +1 -1
  36. data/distro/common/man/man1/knife-node.1 +1 -1
  37. data/distro/common/man/man1/knife-role.1 +1 -1
  38. data/distro/common/man/man1/knife-search.1 +1 -1
  39. data/distro/common/man/man1/knife-ssh.1 +1 -1
  40. data/distro/common/man/man1/knife-status.1 +1 -1
  41. data/distro/common/man/man1/knife-tag.1 +1 -1
  42. data/distro/common/man/man1/knife.1 +1 -1
  43. data/distro/common/man/man8/chef-client.8 +1 -1
  44. data/distro/common/man/man8/chef-expander.8 +1 -1
  45. data/distro/common/man/man8/chef-expanderctl.8 +1 -1
  46. data/distro/common/man/man8/chef-server-webui.8 +1 -1
  47. data/distro/common/man/man8/chef-server.8 +1 -1
  48. data/distro/common/man/man8/chef-solo.8 +1 -1
  49. data/distro/common/man/man8/chef-solr.8 +1 -1
  50. data/lib/chef/application/apply.rb +2 -2
  51. data/lib/chef/application/client.rb +8 -0
  52. data/lib/chef/client.rb +28 -0
  53. data/lib/chef/config.rb +2 -0
  54. data/lib/chef/cookbook/metadata.rb +0 -2
  55. data/lib/chef/dsl/data_query.rb +5 -0
  56. data/lib/chef/dsl/include_attribute.rb +3 -0
  57. data/lib/chef/dsl/include_recipe.rb +3 -0
  58. data/lib/chef/dsl/platform_introspection.rb +5 -0
  59. data/lib/chef/dsl/recipe.rb +4 -1
  60. data/lib/chef/exceptions.rb +1 -0
  61. data/lib/chef/formatters/error_inspectors/resource_failure_inspector.rb +8 -0
  62. data/lib/chef/mixin/deep_merge.rb +26 -0
  63. data/lib/chef/mixin/deprecation.rb +35 -0
  64. data/lib/chef/mixin/language.rb +16 -4
  65. data/lib/chef/mixin/language_include_attribute.rb +7 -1
  66. data/lib/chef/mixin/language_include_recipe.rb +7 -1
  67. data/lib/chef/mixin/recipe_definition_dsl_core.rb +4 -2
  68. data/lib/chef/mixins.rb +1 -1
  69. data/lib/chef/node.rb +0 -2
  70. data/lib/chef/node/attribute.rb +22 -17
  71. data/lib/chef/node/attribute_collections.rb +8 -1
  72. data/lib/chef/platform.rb +9 -0
  73. data/lib/chef/provider/cookbook_file.rb +28 -0
  74. data/lib/chef/resource.rb +12 -6
  75. data/lib/chef/version.rb +1 -1
  76. data/lib/chef/win32/api/security.rb +45 -1
  77. data/lib/chef/win32/registry.rb +23 -12
  78. data/lib/chef/win32/security.rb +19 -0
  79. data/spec/data/shef-config.rb +3 -0
  80. data/spec/functional/knife/smoke_test.rb +34 -0
  81. data/spec/functional/resource/cookbook_file_spec.rb +19 -0
  82. data/spec/functional/resource/registry_spec.rb +8 -12
  83. data/spec/functional/shell_spec.rb +5 -4
  84. data/spec/functional/win32/security_spec.rb +37 -0
  85. data/spec/spec_helper.rb +6 -0
  86. data/spec/support/lib/chef/resource/cat.rb +3 -5
  87. data/spec/support/lib/chef/resource/one_two_three_four.rb +8 -10
  88. data/spec/support/lib/chef/resource/zen_master.rb +8 -10
  89. data/spec/support/shared/functional/file_resource.rb +18 -0
  90. data/spec/support/shared/functional/securable_resource.rb +73 -70
  91. data/spec/unit/chef_fs/diff_spec.rb +30 -29
  92. data/spec/unit/client_spec.rb +62 -0
  93. data/spec/unit/mixin/deep_merge_spec.rb +37 -0
  94. data/spec/unit/mixin/deprecation_spec.rb +23 -0
  95. data/spec/unit/node/attribute_spec.rb +47 -0
  96. data/spec/unit/registry_helper_spec.rb +7 -5
  97. data/spec/unit/resource_spec.rb +23 -0
  98. metadata +4 -3
  99. data/lib/chef/mixin/check_helper.rb +0 -31
@@ -17,7 +17,7 @@
17
17
 
18
18
  class Chef
19
19
  CHEF_ROOT = File.dirname(File.expand_path(File.dirname(__FILE__)))
20
- VERSION = '11.0.0.beta.0'
20
+ VERSION = '11.0.0.beta.1'
21
21
  end
22
22
 
23
23
  # NOTE: the Chef::Version class is defined in version_class.rb
@@ -226,6 +226,50 @@ class Chef
226
226
  :SidTypeLabel
227
227
  ]
228
228
 
229
+ TOKEN_INFORMATION_CLASS = enum :TOKEN_INFORMATION_CLASS, [
230
+ :TokenUser, 1,
231
+ :TokenGroups,
232
+ :TokenPrivileges,
233
+ :TokenOwner,
234
+ :TokenPrimaryGroup,
235
+ :TokenDefaultDacl,
236
+ :TokenSource,
237
+ :TokenType,
238
+ :TokenImpersonationLevel,
239
+ :TokenStatistics,
240
+ :TokenRestrictedSids,
241
+ :TokenSessionId,
242
+ :TokenGroupsAndPrivileges,
243
+ :TokenSessionReference,
244
+ :TokenSandBoxInert,
245
+ :TokenAuditPolicy,
246
+ :TokenOrigin,
247
+ :TokenElevationType,
248
+ :TokenLinkedToken,
249
+ :TokenElevation,
250
+ :TokenHasRestrictions,
251
+ :TokenAccessInformation,
252
+ :TokenVirtualizationAllowed,
253
+ :TokenVirtualizationEnabled,
254
+ :TokenIntegrityLevel,
255
+ :TokenUIAccess,
256
+ :TokenMandatoryPolicy,
257
+ :TokenLogonSid,
258
+ :TokenIsAppContainer,
259
+ :TokenCapabilities,
260
+ :TokenAppContainerSid,
261
+ :TokenAppContainerNumber,
262
+ :TokenUserClaimAttributes,
263
+ :TokenDeviceClaimAttributes,
264
+ :TokenRestrictedUserClaimAttributes,
265
+ :TokenRestrictedDeviceClaimAttributes,
266
+ :TokenDeviceGroups,
267
+ :TokenRestrictedDeviceGroups,
268
+ :TokenSecurityAttributes,
269
+ :TokenIsRestricted,
270
+ :MaxTokenInfoClass
271
+ ]
272
+
229
273
  # SECURITY_DESCRIPTOR is an opaque structure whose contents can vary. Pass the
230
274
  # pointer around and free it with LocalFree.
231
275
  # http://msdn.microsoft.com/en-us/library/windows/desktop/aa379561(v=vs.85).aspx
@@ -334,7 +378,7 @@ class Chef
334
378
  safe_attach_function :SetSecurityDescriptorGroup, [ :pointer, :pointer, :BOOL ], :BOOL
335
379
  safe_attach_function :SetSecurityDescriptorOwner, [ :pointer, :pointer, :BOOL ], :BOOL
336
380
  safe_attach_function :SetSecurityDescriptorSacl, [ :pointer, :BOOL, :pointer, :BOOL ], :BOOL
337
-
381
+ safe_attach_function :GetTokenInformation, [ :HANDLE, :TOKEN_INFORMATION_CLASS, :pointer, :DWORD, :PDWORD ], :BOOL
338
382
  end
339
383
  end
340
384
  end
@@ -21,6 +21,7 @@ require 'chef/reserved_names'
21
21
  if RUBY_PLATFORM =~ /mswin|mingw32|windows/
22
22
  require 'win32/registry'
23
23
  require 'ruby-wmi'
24
+ require 'win32/api'
24
25
  end
25
26
 
26
27
  class Chef
@@ -115,28 +116,38 @@ class Chef
115
116
  Chef::Log.debug("Registry key #{key_path}, does not exist, not deleting")
116
117
  return true
117
118
  end
118
- hive, key = get_hive_and_key(key_path)
119
- key_parent = key.split("\\")
120
- key_to_delete = key_parent.pop
121
- key_parent = key_parent.join("\\")
119
+ #key_path is in the form "HKLM\Software\Opscode" for example, extracting
120
+ #hive = HKLM,
121
+ #hive_namespace = ::Win32::Registry::HKEY_LOCAL_MACHINE
122
+ hive = key_path.split("\\").shift
123
+ hive_namespace, key_including_parent = get_hive_and_key(key_path)
122
124
  if has_subkeys?(key_path)
123
125
  if recursive == true
124
- hive.open(key_parent, ::Win32::Registry::KEY_WRITE | registry_system_architecture) do |reg|
126
+ subkeys = get_subkeys(key_path)
127
+ subkeys.each do |key|
128
+ keypath_to_check = hive+"\\"+key_including_parent+"\\"+key
125
129
  Chef::Log.debug("Deleting registry key #{key_path} recursively")
126
- reg.delete_key(key_to_delete,recursive)
130
+ delete_key(keypath_to_check, true)
127
131
  end
132
+ delete_key_ex(hive_namespace, key_including_parent)
128
133
  else
129
134
  raise Chef::Exceptions::Win32RegNoRecursive, "Registry key #{key_path} has subkeys, and recursive not specified"
130
135
  end
131
136
  else
132
- hive.open(key_parent, ::Win32::Registry::KEY_WRITE | registry_system_architecture) do |reg|
133
- Chef::Log.debug("Deleting registry key #{key_path}")
134
- reg.delete_key(key_to_delete)
135
- end
137
+ delete_key_ex(hive_namespace, key_including_parent)
138
+ return true
136
139
  end
137
140
  true
138
141
  end
139
142
 
143
+ #Using the 'RegDeleteKeyEx' Windows API that correctly supports WOW64 systems (Win2003)
144
+ #instead of the 'RegDeleteKey'
145
+ def delete_key_ex(hive, key)
146
+ regDeleteKeyEx = ::Win32::API.new('RegDeleteKeyEx', 'LPLL', 'L', 'advapi32')
147
+ hive_num = hive.hkey - (1 << 32)
148
+ regDeleteKeyEx.call(hive_num, key, ::Win32::Registry::KEY_WRITE | registry_system_architecture, 0)
149
+ end
150
+
140
151
  def key_exists?(key_path)
141
152
  hive, key = get_hive_and_key(key_path)
142
153
  begin
@@ -204,8 +215,8 @@ class Chef
204
215
  hive.open(key, ::Win32::Registry::KEY_READ | registry_system_architecture) do |reg|
205
216
  reg.each do |val_name, val_type, val_data|
206
217
  if val_name == value[:name] &&
207
- val_type == get_type_from_name(value[:type]) &&
208
- val_data == value[:data]
218
+ val_type == get_type_from_name(value[:type]) &&
219
+ val_data == value[:data]
209
220
  return true
210
221
  end
211
222
  end
@@ -478,6 +478,25 @@ class Chef
478
478
  token.adjust_privileges(old_privileges)
479
479
  end
480
480
  end
481
+
482
+ # Checks if the caller has the admin privileges in their
483
+ # security token
484
+ def self.has_admin_privileges?
485
+ if Chef::Platform.windows_server_2003?
486
+ # Admin privileges do not exist on Windows Server 2003
487
+
488
+ true
489
+ else
490
+ process_token = open_process_token(Chef::ReservedNames::Win32::Process.get_current_process, TOKEN_READ)
491
+ elevation_result = FFI::Buffer.new(:ulong)
492
+ elevation_result_size = FFI::MemoryPointer.new(:uint32)
493
+ success = GetTokenInformation(process_token.handle.handle, :TokenElevation, elevation_result, 4, elevation_result_size)
494
+
495
+ # Assume process is not elevated if the call fails.
496
+ # Process is elevated if the result is different than 0.
497
+ success && (elevation_result.read_ulong != 0)
498
+ end
499
+ end
481
500
  end
482
501
  end
483
502
  end
@@ -3,5 +3,8 @@ Ohai::Config[:disabled_plugins] << "virtualization" << "darwin::virtualization"
3
3
  Ohai::Config[:disabled_plugins] << 'darwin::uptime' << 'darwin::filesystem' << 'dmi' << 'lanuages' << 'perl' << 'python' << 'java'
4
4
  Ohai::Config[:disabled_plugins] << "linux::block_device" << "linux::kernel" << "linux::ssh_host_key" << "linux::virtualization"
5
5
  Ohai::Config[:disabled_plugins] << "linux::cpu" << "linux::memory" << "ec2" << "rackspace" << "eucalyptus" << "ip_scopes"
6
+ Ohai::Config[:disabled_plugins] << "solaris2::cpu" << "solaris2::dmi" << "solaris2::filesystem" << "solaris2::kernel"
7
+ Ohai::Config[:disabled_plugins] << "solaris2::virtualization" << "solaris2::zpools"
6
8
  Ohai::Config[:disabled_plugins] << 'c' << 'php' << 'mono' << 'groovy' << 'lua' << 'erlang'
9
+ Ohai::Config[:disabled_plugins] << "kernel" << "linux::filesystem" << "ruby"
7
10
 
@@ -0,0 +1,34 @@
1
+ #
2
+ # Author:: Daniel DeLeo (<dan@opscode.com>)
3
+ # Copyright:: Copyright (c) 2010 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 'spec_helper'
20
+
21
+ describe "knife smoke tests" do
22
+
23
+ # Since our specs load all code, there could be a case where knife does not
24
+ # run correctly b/c of a missing require, but is not caught by other tests.
25
+ #
26
+ # We run `knife -v` to verify that knife at least loads all its code.
27
+ it "can run and print its version" do
28
+ knife_path = File.expand_path("../../bin/knife", CHEF_SPEC_DATA)
29
+ knife_cmd = Mixlib::ShellOut.new("#{knife_path} -v")
30
+ knife_cmd.run_command
31
+ knife_cmd.error!
32
+ knife_cmd.stdout.should include(Chef::VERSION)
33
+ end
34
+ end
@@ -60,4 +60,23 @@ describe Chef::Resource::CookbookFile do
60
60
  end
61
61
 
62
62
  it_behaves_like "a file resource"
63
+
64
+ # These examples cover CHEF-3467 where unexpected and incorrect
65
+ # permissions can result on Windows because CookbookFile's
66
+ # implementation
67
+ # stages files in temp.
68
+ context "targets a file outside of the system temp directory" do
69
+ let(:windows_non_temp_dir) { File.join(ENV['systemdrive'], make_tmpname(file_base, "non-temp")) }
70
+ let(:path) { File.join(windows_non_temp_dir, make_tmpname(file_base, nil)) }
71
+
72
+ before do
73
+ FileUtils::mkdir_p(windows_non_temp_dir) if Chef::Platform.windows?
74
+ end
75
+
76
+ after do
77
+ FileUtils.rm_r(windows_non_temp_dir) if Chef::Platform.windows? && File.exists?(windows_non_temp_dir)
78
+ end
79
+
80
+ it_behaves_like "a file that inherits permissions from a parent directory"
81
+ end
63
82
  end
@@ -54,20 +54,16 @@ describe Chef::Resource::RegistryKey, :windows_only do
54
54
  let(:resource_name) { "This is the name of my Resource" }
55
55
 
56
56
  def clean_registry
57
- # clean 64-bit space on WOW64
58
- begin
59
- hive_class.open(key_parent, Win32::Registry::KEY_WRITE | 0x0100) do |reg|
60
- reg.delete_key(child, true)
61
- end
62
- rescue
57
+ if windows64?
58
+ # clean 64-bit space on WOW64
59
+ @registry.architecture = :x86_64
60
+ @registry.delete_key(reg_parent, true)
61
+ @registry.architecture = :machine
63
62
  end
64
63
  # clean 32-bit space on WOW64
65
- begin
66
- hive_class.open(key_parent, Win32::Registry::KEY_WRITE | 0x0200) do |reg|
67
- reg.delete_key(child, true)
68
- end
69
- rescue
70
- end
64
+ @registry.architecture = :i386
65
+ @registry.delete_key(reg_parent, true)
66
+ @registry.architecture = :machine
71
67
  end
72
68
 
73
69
  def reset_registry
@@ -33,8 +33,9 @@ describe Chef::Shell do
33
33
  begin
34
34
  buffer << io.read_nonblock(1)
35
35
  rescue Errno::EWOULDBLOCK, Errno::EAGAIN, Errno::EIO, EOFError
36
+ sleep 0.01
36
37
  end
37
- if Time.new - start > 15
38
+ if Time.new - start > 30
38
39
  STDERR.puts "did not read expected value `#{expected_value}' within 15s"
39
40
  STDERR.puts "Buffer so far: `#{buffer}'"
40
41
  break
@@ -51,7 +52,7 @@ describe Chef::Shell do
51
52
  STDERR.puts("chef-shell tty did not exit cleanly, killing it")
52
53
  Process.kill(:KILL, pid)
53
54
  end
54
- sleep 0.1
55
+ sleep 0.01
55
56
  end
56
57
  exitstatus[1]
57
58
  end
@@ -60,7 +61,7 @@ describe Chef::Shell do
60
61
  # Windows ruby installs don't (always?) have PTY,
61
62
  # so hide the require here
62
63
  require 'pty'
63
- config = File.expand_path("chef-config.rb", CHEF_SPEC_DATA)
64
+ config = File.expand_path("shef-config.rb", CHEF_SPEC_DATA)
64
65
  path_to_chef_shell = File.expand_path("../../../bin/chef-shell", __FILE__)
65
66
  reader, writer, pid = PTY.spawn("#{path_to_chef_shell} -c #{config} #{options}")
66
67
  read_until(reader, "chef >")
@@ -69,7 +70,7 @@ describe Chef::Shell do
69
70
  output = read_until(reader, '=> "done"')
70
71
  writer.print("exit\n")
71
72
  read_until(reader, "exit")
72
- read_until(reader, "exit")
73
+ read_until(reader, "\n")
73
74
  read_until(reader, "\n")
74
75
  writer.close
75
76
 
@@ -0,0 +1,37 @@
1
+ #
2
+ # Author:: Serdar Sutay (<serdar@opscode.com>)
3
+ # Copyright:: Copyright (c) 2012 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 'spec_helper'
20
+ if Chef::Platform.windows?
21
+ require 'chef/win32/security'
22
+ end
23
+
24
+ describe 'Chef::Win32::Security', :windows_only do
25
+ it "has_admin_privileges? returns true when running as admin" do
26
+ Chef::ReservedNames::Win32::Security.has_admin_privileges?.should == true
27
+ end
28
+
29
+ # We've done some investigation adding a negative test and it turned
30
+ # out to be a lot of work since mixlib-shellout doesn't have user
31
+ # support for windows.
32
+ #
33
+ # TODO - Add negative tests once mixlib-shellout has user support
34
+ it "has_admin_privileges? returns false when running as non-admin" do
35
+ pending "requires user support in mixlib-shellout"
36
+ end
37
+ end
@@ -18,6 +18,12 @@
18
18
  # If you need to add anything in here, don't.
19
19
  # Add it to one of the files in spec/support
20
20
 
21
+ # Configure this first so it doesn't trigger annoying warning when we use it.
22
+ # Main rspec configuration comes later
23
+ RSpec.configure do |config|
24
+ config.treat_symbols_as_metadata_keys_with_true_values = true
25
+ end
26
+
21
27
  # Abuse ruby's constant lookup to avoid undefined constant errors
22
28
  module Shell
23
29
  JUST_TESTING_MOVE_ALONG = true unless defined? JUST_TESTING_MOVE_ALONG
@@ -29,12 +29,10 @@ class Chef
29
29
  end
30
30
 
31
31
  def pretty_kitty(arg=nil)
32
- set_if_args(@pretty_kitty, arg) do
33
- case arg
34
- when true, false
35
- @pretty_kitty = arg
36
- end
32
+ if arg == true or arg == false
33
+ @pretty_kitty = arg
37
34
  end
35
+ @pretty_kitty
38
36
  end
39
37
  end
40
38
  end
@@ -6,9 +6,9 @@
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
7
7
  # you may not use this file except in compliance with the License.
8
8
  # You may obtain a copy of the License at
9
- #
9
+ #
10
10
  # http://www.apache.org/licenses/LICENSE-2.0
11
- #
11
+ #
12
12
  # Unless required by applicable law or agreed to in writing, software
13
13
  # distributed under the License is distributed on an "AS IS" BASIS,
14
14
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -20,23 +20,21 @@ class Chef
20
20
  class Resource
21
21
  class OneTwoThreeFour < Chef::Resource
22
22
  attr_reader :i_can_count
23
-
23
+
24
24
  def initialize(name, run_context)
25
25
  @resource_name = :one_two_three_four
26
26
  super
27
27
  end
28
-
28
+
29
29
  def i_can_count(tf)
30
30
  @i_can_count = tf
31
31
  end
32
-
32
+
33
33
  def something(arg=nil)
34
- set_if_args(@something, arg) do
35
- case arg
36
- when true, false
37
- @something = arg
38
- end
34
+ if arg == true or arg == false
35
+ @something = arg
39
36
  end
37
+ @something
40
38
  end
41
39
  end
42
40
  end
@@ -6,9 +6,9 @@
6
6
  # Licensed under the Apache License, Version 2.0 (the "License");
7
7
  # you may not use this file except in compliance with the License.
8
8
  # You may obtain a copy of the License at
9
- #
9
+ #
10
10
  # http://www.apache.org/licenses/LICENSE-2.0
11
- #
11
+ #
12
12
  # Unless required by applicable law or agreed to in writing, software
13
13
  # distributed under the License is distributed on an "AS IS" BASIS,
14
14
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -23,23 +23,21 @@ class Chef
23
23
  class Resource
24
24
  class ZenMaster < Chef::Resource
25
25
  attr_reader :peace
26
-
26
+
27
27
  def initialize(name, run_context=nil)
28
28
  @resource_name = :zen_master
29
29
  super
30
30
  end
31
-
31
+
32
32
  def peace(tf)
33
33
  @peace = tf
34
34
  end
35
-
35
+
36
36
  def something(arg=nil)
37
- set_if_args(@something, arg) do
38
- case arg
39
- when true, false
40
- @something = arg
41
- end
37
+ if arg == true or arg == false
38
+ @something = arg
42
39
  end
40
+ @something
43
41
  end
44
42
  end
45
43
  end