diff options
author | AJ Christensen <aj@junglist.gen.nz> | 2008-09-26 15:31:47 +1200 |
---|---|---|
committer | AJ Christensen <aj@junglist.gen.nz> | 2008-10-01 09:34:28 +1300 |
commit | e252ac8bb242056cd26094163d13861184a79800 (patch) | |
tree | a918e8d1527943ef99fdf85f9de76dd1b942e128 | |
parent | 641004282f445220542eca3bb9af41658913511d (diff) | |
download | chef-e252ac8bb242056cd26094163d13861184a79800.tar.gz |
Working towards supports[:has_status] etc.
-rw-r--r-- | lib/chef/provider/service.rb | 1 | ||||
-rw-r--r-- | lib/chef/resource/service.rb | 24 |
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, |