Sha256: c4f9ce66c7c468d9a7e3a4d9309e0f05518a950f2380d4d127c95ab929161ac4

Contents?: true

Size: 1.51 KB

Versions: 14

Compression:

Stored size: 1.51 KB

Contents

#
# Copyright 2015, Nathan Williams <nath.e.will@gmail.com>
#
# 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.
#

class Chef
  module Sugar
    module Init
      extend self

      #
      # Determine if the current init system is systemd.
      #
      # @return [Boolean]
      #
      def systemd?(node)
        File.exist?('/bin/systemctl')
      end

      #
      # Determine if the current init system is upstart.
      #
      # @return [Boolean]
      #
      def upstart?(node)
        File.executable?('/sbin/initctl')
      end

      #
      # Determine if the current init system is runit.
      #
      # @return [Boolean]
      #
      def runit?(node)
        File.executable?('/sbin/runit-init')
      end
    end

    module DSL
      # @see Chef::Sugar::Init#systemd?
      def systemd?; Chef::Sugar::Init.systemd?(node); end

      # @see Chef::Sugar::Init#upstart?
      def upstart?; Chef::Sugar::Init.upstart?(node); end

      # @see Chef::Sugar::Init#runit?
      def runit?; Chef::Sugar::Init.runit?(node); end
    end
  end
end

Version data entries

14 entries across 14 versions & 3 rubygems

Version Path
chef-sugar-ng-5.1.12 lib/chef/sugar/init.rb
chef-sugar-5.1.12 lib/chef/sugar/init.rb
chef-sugar-ng-5.1.11 lib/chef/sugar/init.rb
chef-sugar-5.1.11 lib/chef/sugar/init.rb
chef-sugar-sre-5.1.13 lib/chef/sugar/init.rb
chef-sugar-ng-5.1.9 lib/chef/sugar/init.rb
chef-sugar-5.1.9 lib/chef/sugar/init.rb
chef-sugar-ng-5.1.8 lib/chef/sugar/init.rb
chef-sugar-5.1.8 lib/chef/sugar/init.rb
chef-sugar-ng-5.0.4 lib/chef/sugar/init.rb
chef-sugar-ng-5.0.3 lib/chef/sugar/init.rb
chef-sugar-ng-5.0.2 lib/chef/sugar/init.rb
chef-sugar-ng-5.0.1 lib/chef/sugar/init.rb
chef-sugar-5.0.1 lib/chef/sugar/init.rb