summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAJ Christensen <aj@junglist.gen.nz>2008-09-26 15:31:47 +1200
committerAJ Christensen <aj@junglist.gen.nz>2008-10-01 09:34:28 +1300
commite252ac8bb242056cd26094163d13861184a79800 (patch)
treea918e8d1527943ef99fdf85f9de76dd1b942e128
parent641004282f445220542eca3bb9af41658913511d (diff)
downloadchef-e252ac8bb242056cd26094163d13861184a79800.tar.gz
Working towards supports[:has_status] etc.
-rw-r--r--lib/chef/provider/service.rb1
-rw-r--r--lib/chef/resource/service.rb24
2 files changed, 4 insertions, 21 deletions
diff --git a/lib/chef/provider/service.rb b/lib/chef/provider/service.rb
index ee829e6df7..716ea420d2 100644
--- a/lib/chef/provider/service.rb
+++ b/lib/chef/provider/service.rb
@@ -30,6 +30,7 @@ class Chef
end
def load_current_resource
+ # Service should be inherited by the Service providers and then super this load_current_resource to get @current_resource.
@current_resource = Chef::Resource::Service.new(@new_resource.name)
@current_resource.service_name(@new_resource.service_name)
end
diff --git a/lib/chef/resource/service.rb b/lib/chef/resource/service.rb
index 5d7ef03f4b..29f4632f5f 100644
--- a/lib/chef/resource/service.rb
+++ b/lib/chef/resource/service.rb
@@ -25,14 +25,14 @@ class Chef
@resource_name = :service
@service_name = name
@enabled = nil
- @hasstatus = nil
- @hasrestart = nil
+ @running = nil
@pattern = nil
@start = nil
@stop = nil
@status = nil
@restart = nil
@action = "none"
+ @supports = { :has_restart => false, :has_status => false }
@allowed_actions.push(:enable, :disable, :start, :stop)
end
@@ -44,25 +44,7 @@ class Chef
)
end
- # bool, init script has a status action
- def hasstatus(arg=nil)
- set_or_return(
- :hasstatus,
- arg,
- :kind_of => [ String ]
- )
- end
-
- # bool, init script has a restart action
- def hasrestart(arg=nil)
- set_or_return(
- :hasrestart,
- arg,
- :kind_of => [ TrueClass, FalseClass ]
- )
- end
-
- # regex for match against ps -ef when hasstatus => false and status = nil
+ # regex for match against ps -ef when !supports[:has_status] && status == nil
def pattern(arg=nil)
set_or_return(
:pattern,