summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Dodge <mikedodge04@fb.com>2017-03-02 10:02:35 -0800
committerMike Dodge <mikedodge04@fb.com>2017-03-02 10:02:35 -0800
commit0b66a3a5cbecec2921d296cc2a45c3993888c3bb (patch)
treea08d717676c7977c9d1abeff7d52d277edaeb5a5
parentf1df2bd9bccfc0bbe82777fff42b9788fdf36706 (diff)
downloadchef-0b66a3a5cbecec2921d296cc2a45c3993888c3bb.tar.gz
Adding restart action to launchd resource
At first we wanted only support native actions with the launchd resource and launchd does not have the concept of restart. You would unload and load. But not having a restart was causing more confusion to people.
-rw-r--r--lib/chef/provider/launchd.rb4
-rw-r--r--lib/chef/resource/launchd.rb2
2 files changed, 5 insertions, 1 deletions
diff --git a/lib/chef/provider/launchd.rb b/lib/chef/provider/launchd.rb
index a58954c707..9c368c2b48 100644
--- a/lib/chef/provider/launchd.rb
+++ b/lib/chef/provider/launchd.rb
@@ -85,6 +85,10 @@ class Chef
manage_service(:disable)
end
+ def action_restart
+ manage_service(:restart)
+ end
+
def manage_plist(action)
if source
res = cookbook_file_resource
diff --git a/lib/chef/resource/launchd.rb b/lib/chef/resource/launchd.rb
index c78ffa3f0e..2941d5a4b0 100644
--- a/lib/chef/resource/launchd.rb
+++ b/lib/chef/resource/launchd.rb
@@ -27,7 +27,7 @@ class Chef
identity_attr :label
default_action :create
- allowed_actions :create, :create_if_missing, :delete, :enable, :disable
+ allowed_actions :create, :create_if_missing, :delete, :enable, :disable, :restart
property :label, String, default: lazy { name }, identity: true
property :backup, [Integer, FalseClass]