From dcd9a4be5fb88d30272ddbbb5971f4a964a77dfa Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Fri, 24 Apr 2020 13:50:53 -0700 Subject: Move the windows only timeout property from service to windows_service Also give it a real default. This improves our automatic documentation generation. Signed-off-by: Tim Smith --- lib/chef/provider/service/windows.rb | 4 +--- lib/chef/resource/service.rb | 5 ----- lib/chef/resource/windows_service.rb | 6 ++++++ 3 files changed, 7 insertions(+), 8 deletions(-) diff --git a/lib/chef/provider/service/windows.rb b/lib/chef/provider/service/windows.rb index 63cc5fd26c..9a7f5fa1d8 100644 --- a/lib/chef/provider/service/windows.rb +++ b/lib/chef/provider/service/windows.rb @@ -47,8 +47,6 @@ class Chef::Provider::Service::Windows < Chef::Provider::Service START_PENDING = "start pending".freeze STOP_PENDING = "stop pending".freeze - TIMEOUT = 60 - SERVICE_RIGHT = "SeServiceLogonRight".freeze def load_current_resource @@ -336,7 +334,7 @@ class Chef::Provider::Service::Windows < Chef::Provider::Service end def resource_timeout - @resource_timeout ||= @new_resource.timeout || TIMEOUT + @resource_timeout ||= @new_resource.timeout end def spawn_command_thread diff --git a/lib/chef/resource/service.rb b/lib/chef/resource/service.rb index 50a7dda437..b28ba365b2 100644 --- a/lib/chef/resource/service.rb +++ b/lib/chef/resource/service.rb @@ -114,11 +114,6 @@ class Chef property :priority, [ Integer, String, Hash ], description: "Debian platform only. The relative priority of the program for start and shutdown ordering. May be an integer or a Hash. An integer is used to define the start run levels; stop run levels are then 100-integer. A Hash is used to define values for specific run levels. For example, { 2 => [:start, 20], 3 => [:stop, 55] } will set a priority of twenty for run level two and a priority of fifty-five for run level three." - # timeout only applies to the windows service manager - property :timeout, Integer, - description: "Microsoft Windows platform only. The amount of time (in seconds) to wait before timing out.", - desired_state: false - property :parameters, Hash, description: "Upstart only: A hash of parameters to pass to the service command for use in the service definition." diff --git a/lib/chef/resource/windows_service.rb b/lib/chef/resource/windows_service.rb index 51d016a4f2..73a8ce527d 100644 --- a/lib/chef/resource/windows_service.rb +++ b/lib/chef/resource/windows_service.rb @@ -41,6 +41,12 @@ class Chef allowed_actions :configure_startup, :create, :delete, :configure + # timeout only applies to the windows service manager + property :timeout, Integer, + description: "The amount of time (in seconds) to wait before timing out.", + default: 60, + desired_state: false + property :display_name, String, regex: /^.{1,256}$/, description: "The display name to be used by user interface programs to identify the service. This string has a maximum length of 256 characters.", validation_message: "The display_name can only be a maximum of 256 characters!", -- cgit v1.2.1