diff options
author | Mike Dodge <mikedodge04@fb.com> | 2015-03-10 02:22:17 -0700 |
---|---|---|
committer | Mike Dodge <mikedodge04@fb.com> | 2015-03-10 23:22:43 -0700 |
commit | 07da5a4c2498ca68d485ef927dd23e5308d6e62b (patch) | |
tree | 79f0d31635f3e19e13eee031b00c5af0c882777f /lib/chef/resource/macosx_service.rb | |
parent | 4b0f63b90cc72365fccd3f4f2e07721de7af80e6 (diff) | |
download | chef-07da5a4c2498ca68d485ef927dd23e5308d6e62b.tar.gz |
Load LaunchAgents as console user, adding plist and session_type options
Proposed changes to chef mac osx service provider. This adds two
resource parameters, @plist and @session_type and changes logic to Load
LaunchAgents as Console user
@plist: Adds the logic to handle
(https://github.com/chef/chef/issues/2200) by Giving the user the
option to pass a plist, in the case that the plist name and label name
don't match.
@session_type to help account launching
the service as the console user with a different session type.
( Im a Facebook employee and PhilD will do the final merge. )
Diffstat (limited to 'lib/chef/resource/macosx_service.rb')
-rw-r--r-- | lib/chef/resource/macosx_service.rb | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/lib/chef/resource/macosx_service.rb b/lib/chef/resource/macosx_service.rb new file mode 100644 index 0000000000..715e9a80ae --- /dev/null +++ b/lib/chef/resource/macosx_service.rb @@ -0,0 +1,55 @@ +# vim: syntax=ruby:expandtab:shiftwidth=2:softtabstop=2:tabstop=2 +# +# Author:: Mike Dodge (<mikedodge04@gmail.com>) +# Copyright:: Copyright (c) 2009 Opscode, Inc. +# License:: Apache License, Version 2.0 +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +require 'chef/resource/service' + +class Chef + class Resource + class MacosxService < Chef::Resource::Service + + provides :service, os: "darwin" + provides :macosx_service, os: "darwin" + + def initialize(name, run_context=nil) + super + @plist = nil + @session_type = nil + end + + # This will enable user to pass a plist in the case + # that the filename and label for the service dont match + def plist(arg=nil) + set_or_return( + :plist, + arg, + :kind_of => String + ) + end + + def session_type(arg=nil) + set_or_return( + :session_type, + arg, + :kind_of => String + ) + end + + end + end +end |