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
41
41
feature :delayed_startable , "The provider can set service to delayed start" ,
42
42
:methods => [ :delayed_start ]
43
43
44
+ feature :manual_startable , "The provider can set service to manual start" ,
45
+ :methods => [ :manual_start ]
46
+
44
47
feature :controllable , "The provider uses a control variable."
45
48
46
49
feature :flaggable , "The provider can pass flags to the service."
@@ -70,7 +73,7 @@ module Puppet
70
73
provider . disable
71
74
end
72
75
73
- newvalue ( :manual , :event => :service_manual_start ) do
76
+ newvalue ( :manual , :event => :service_manual_start , :required_features => :manual_startable ) do
74
77
provider . manual_start
75
78
end
76
79
@@ -92,13 +95,6 @@ def insync?(current)
92
95
return provider . enabled_insync? ( current ) if provider . respond_to? ( :enabled_insync? )
93
96
super ( current )
94
97
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
102
98
end
103
99
104
100
# 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
84
84
)
85
85
end
86
86
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
90
88
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' /
93
91
)
94
92
end
95
93
You can’t perform that action at this time.
0 commit comments