File tree Expand file tree Collapse file tree 2 files changed +7
-13
lines changed Expand file tree Collapse file tree 2 files changed +7
-13
lines changed Original file line number Diff line number Diff line change @@ -41,6 +41,9 @@ module Puppet
4141 feature :delayed_startable , "The provider can set service to delayed start" ,
4242 :methods => [ :delayed_start ]
4343
44+ feature :manual_startable , "The provider can set service to manual start" ,
45+ :methods => [ :manual_start ]
46+
4447 feature :controllable , "The provider uses a control variable."
4548
4649 feature :flaggable , "The provider can pass flags to the service."
@@ -70,7 +73,7 @@ module Puppet
7073 provider . disable
7174 end
7275
73- newvalue ( :manual , :event => :service_manual_start ) do
76+ newvalue ( :manual , :event => :service_manual_start , :required_features => :manual_startable ) do
7477 provider . manual_start
7578 end
7679
@@ -92,13 +95,6 @@ def insync?(current)
9295 return provider . enabled_insync? ( current ) if provider . respond_to? ( :enabled_insync? )
9396 super ( current )
9497 end
95-
96- validate do |value |
97- super ( value )
98- if ( value == :manual ) && !Puppet ::Util ::Platform . windows?
99- raise Puppet ::Error . new ( _ ( "Setting enable to %{value} is only supported on Microsoft Windows." ) % { value : value . to_s } )
100- end
101- end
10298 end
10399
104100 # Handle whether the service should actually be running right now.
Original file line number Diff line number Diff line change @@ -84,12 +84,10 @@ def safely_load_service_type
8484 )
8585 end
8686
87- it "should not support :manual as a value when not on Windows" do
88- allow ( Puppet ::Util ::Platform ) . to receive ( :windows? ) . and_return ( false )
89-
87+ it "should not support :manual as a value" do
9088 expect { Puppet ::Type . type ( :service ) . new ( :name => "yay" , :enable => :manual ) } . to raise_error (
91- Puppet ::Error ,
92- /Setting enable to manual is only supported on Microsoft Windows \. /
89+ Puppet ::ResourceError ,
90+ /Provider .+ must have features 'manual_startable' to set 'enable' to 'manual' /
9391 )
9492 end
9593
You can’t perform that action at this time.
0 commit comments