summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNoah Kantrowitz <noah@coderanger.net>2017-04-11 14:17:09 -0700
committerNoah Kantrowitz <noah@coderanger.net>2017-04-11 14:17:09 -0700
commitc08968e5aa066705bddab542ddab4c9b807ccfc3 (patch)
tree4793164d878202b9613acc7252a4eb743bc7c2ed
parent2fba7ed9f7d0b05671b6a67580b2f0ec539b60ae (diff)
downloadchef-c08968e5aa066705bddab542ddab4c9b807ccfc3.tar.gz
Put in some temporary hacks for the service and user resource for cases where the tests assumed nillable properties.
This will get cleaned up when they are converted to real properties. Signed-off-by: Noah Kantrowitz <noah@coderanger.net>
-rw-r--r--lib/chef/resource/service.rb10
-rw-r--r--lib/chef/resource/user.rb10
2 files changed, 11 insertions, 9 deletions
diff --git a/lib/chef/resource/service.rb b/lib/chef/resource/service.rb
index 0231964fdf..83e44c9d30 100644
--- a/lib/chef/resource/service.rb
+++ b/lib/chef/resource/service.rb
@@ -78,7 +78,7 @@ class Chef
set_or_return(
:start_command,
arg,
- :kind_of => [ String ]
+ :kind_of => [ String, NilClass, FalseClass ]
)
end
@@ -87,7 +87,7 @@ class Chef
set_or_return(
:stop_command,
arg,
- :kind_of => [ String ]
+ :kind_of => [ String, NilClass, FalseClass ]
)
end
@@ -96,7 +96,7 @@ class Chef
set_or_return(
:status_command,
arg,
- :kind_of => [ String ]
+ :kind_of => [ String, NilClass, FalseClass ]
)
end
@@ -105,7 +105,7 @@ class Chef
set_or_return(
:restart_command,
arg,
- :kind_of => [ String ]
+ :kind_of => [ String, NilClass, FalseClass ]
)
end
@@ -113,7 +113,7 @@ class Chef
set_or_return(
:reload_command,
arg,
- :kind_of => [ String ]
+ :kind_of => [ String, NilClass, FalseClass ]
)
end
diff --git a/lib/chef/resource/user.rb b/lib/chef/resource/user.rb
index a1e315ef50..03f2551bf4 100644
--- a/lib/chef/resource/user.rb
+++ b/lib/chef/resource/user.rb
@@ -62,19 +62,21 @@ class Chef
)
end
- def uid(arg = nil)
+ def uid(arg = Chef::NOT_PASSED)
set_or_return(
:uid,
arg,
- :kind_of => [ String, Integer ]
+ :kind_of => [ String, Integer, NilClass ],
+ :coerce => proc {|x| x || nil }
)
end
- def gid(arg = nil)
+ def gid(arg = Chef::NOT_PASSED)
set_or_return(
:gid,
arg,
- :kind_of => [ String, Integer ]
+ :kind_of => [ String, Integer, NilClass ],
+ :coerce => proc {|x| x || nil }
)
end