<commit_before>require 'chef/provider/lwrp_base'
require_relative 'helpers_rhel'

class Chef
  class Provider
    class HttpdService
      class Rhel < Chef::Provider::HttpdService
        use_inline_resources if defined?(use_inline_resources)

        include Httpd::Helpers::Rhel

        def whyrun_supported?
          true
        end

        # break common and service resources into separate
        # functions to allow for overriding in a subclass.
        def action_create
          create_common
          create_service
        end

        def action_delete
          delete_service
          delete_common
        end

        # override me in subclass
        def action_restart
          log 'action :restart not implemented' do
            str = 'action :restart implemented on'
            str << ' Chef::Provider::HttpdService::Rhel.'
            str << ' Please use Chef::Provider::HttpdService::Rhel::Sysvinit'
            str << ' or Chef::Provider::HttpdService::Rhel::Systemd'
            message str
            level :info
          end
        end

        # override me in subclass
        def action_reload
          log 'action :reload not implemented' do
            str = 'action :reload not implemented on'
            str << ' Chef::Provider::HttpdService::Rhel.'
            str << ' Please use Chef::Provider::HttpdService::Rhel::Sysvinit'
            str << ' or Chef::Provider::HttpdService::Rhel::Systemd'
            message str
            level :info
          end
        end

        # override me in subclass
        def create_service
          log 'action create_service not implemented' do
            str = 'action :create not implemented on'
            str << ' Chef::Provider::HttpdService::Rhel.'
            str << ' Please use Chef::Provider::HttpdService::Rhel::Sysvinit'
            str << ' or Chef::Provider::HttpdService::Rhel::Systemd'
            message str
            level :info
          end
        end

        # override me in subclass
        def delete_service
          log 'action delete_service not implemented' do
            str = 'action :delete not implemented on'
            str << ' Chef::Provider::HttpdService::Rhel.'
            str << ' Please use Chef::Provider::HttpdService::Rhel::Sysvinit'
            str << ' or Chef::Provider::HttpdService::Rhel::Systemd'
            message str
            level :info
          end
        end

        # override me in subclass
        def delete_service
          log 'delete_service not implemented' do
            str = 'delete_service not implemented on'
            str << ' Chef::Provider::HttpdService::Rhel.'
            str << ' Please use Chef::Provider::HttpdService::Rhel::Sysvinit'
            str << ' or Chef::Provider::HttpdService::Rhel::Systemd'
            message str
            level :info
          end
        end

        def create_common
          # FIXME: parameterize
          lock_file = nil
          mutex = nil

          #
          # Chef resources
          #
          # software installation
          package "#{new_resource.name} create #{new_resource.package_name}" do
            package_name new_resource.package_name
            action :install
          end

          # remove cruft dropped off by package
          if new_resource.version.to_f < 2.4
            %w(
              /etc/httpd/conf.d/README
              /etc/httpd/conf.d/notrace.conf
              /etc/httpd/conf.d/welcome.conf
              /etc/httpd/conf.d/proxy_ajp.conf
            ).each do |f|
              file "#{new_resource.name} create #{f}" do
                path f
                action :nothing
                subscribes :delete, "package[#{new_resource.name} create httpd]", :immediately
              end
            end
          else
            %w(
              /etc/httpd/conf.d/autoindex.conf
              /etc/httpd/conf.d/README
              /etc/httpd/conf.d/notrace.conf
              /etc/httpd/conf.d/userdir.conf
              /etc/httpd/conf.d/welcome.conf
              /etc/httpd/conf.modules.d/00-base.conf
              /etc/httpd/conf.modules.d/00-dav.conf
              /etc/httpd/conf.modules.d/00-lua.conf
              /etc/httpd/conf.modules.d/00-mpm.conf
              /etc/httpd/conf.modules.d/00-proxy.conf
              /etc/httpd/conf.modules.d/00-systemd.conf
              /etc/httpd/conf.modules.d/01-cgi.conf
            ).each do |f|
              file "#{new_resource.name} create #{f}" do
                path f
                action :nothing
                subscribes :delete, "package[#{new_resource.name} create httpd]", :immediately
              end
            end
          end

          # FIXME: This is needed for serverspec.
          # Move into a serverspec recipe
          package "#{new_resource.name} create net-tools" do
            package_name 'net-tools'
            action :install
          end

          # achieve parity with modules statically compiled into
          # debian and ubuntu
          if new_resource.version.to_f < 2.4
            %w( log_config logio ).each do |m|
              httpd_module "#{new_resource.name} create #{m}" do
                module_name m
                httpd_version new_resource.version
                instance new_resource.instance
                notifies :reload, "service[#{new_resource.name} create #{apache_name}]"
                action :create
              end
            end
          else
            %w( log_config logio unixd version watchdog ).each do |m|<commit_msg>savegame: fixing file subscriptions on amazon<commit_after>require 'chef/provider/lwrp_base'
require_relative 'helpers_rhel'

class Chef
  class Provider
    class HttpdService
      class Rhel < Chef::Provider::HttpdService
        use_inline_resources if defined?(use_inline_resources)

        include Httpd::Helpers::Rhel

        def whyrun_supported?
          true
        end

        # break common and service resources into separate
        # functions to allow for overriding in a subclass.
        def action_create
          create_common
          create_service
        end

        def action_delete
          delete_service
          delete_common
        end

        # override me in subclass
        def action_restart
          log 'action :restart not implemented' do
            str = 'action :restart implemented on'
            str << ' Chef::Provider::HttpdService::Rhel.'
            str << ' Please use Chef::Provider::HttpdService::Rhel::Sysvinit'
            str << ' or Chef::Provider::HttpdService::Rhel::Systemd'
            message str
            level :info
          end
        end

        # override me in subclass
        def action_reload
          log 'action :reload not implemented' do
            str = 'action :reload not implemented on'
            str << ' Chef::Provider::HttpdService::Rhel.'
            str << ' Please use Chef::Provider::HttpdService::Rhel::Sysvinit'
            str << ' or Chef::Provider::HttpdService::Rhel::Systemd'
            message str
            level :info
          end
        end

        # override me in subclass
        def create_service
          log 'action create_service not implemented' do
            str = 'action :create not implemented on'
            str << ' Chef::Provider::HttpdService::Rhel.'
            str << ' Please use Chef::Provider::HttpdService::Rhel::Sysvinit'
            str << ' or Chef::Provider::HttpdService::Rhel::Systemd'
            message str
            level :info
          end
        end

        # override me in subclass
        def delete_service
          log 'action delete_service not implemented' do
            str = 'action :delete not implemented on'
            str << ' Chef::Provider::HttpdService::Rhel.'
            str << ' Please use Chef::Provider::HttpdService::Rhel::Sysvinit'
            str << ' or Chef::Provider::HttpdService::Rhel::Systemd'
            message str
            level :info
          end
        end

        # override me in subclass
        def delete_service
          log 'delete_service not implemented' do
            str = 'delete_service not implemented on'
            str << ' Chef::Provider::HttpdService::Rhel.'
            str << ' Please use Chef::Provider::HttpdService::Rhel::Sysvinit'
            str << ' or Chef::Provider::HttpdService::Rhel::Systemd'
            message str
            level :info
          end
        end

        def create_common
          # FIXME: parameterize
          lock_file = nil
          mutex = nil

          #
          # Chef resources
          #
          # software installation
          package "#{new_resource.name} create #{new_resource.package_name}" do
            package_name new_resource.package_name
            action :install
          end

          # remove cruft dropped off by package
          if new_resource.version.to_f < 2.4
            %w(
              /etc/httpd/conf.d/README
              /etc/httpd/conf.d/notrace.conf
              /etc/httpd/conf.d/welcome.conf
              /etc/httpd/conf.d/proxy_ajp.conf
            ).each do |f|
              file "#{new_resource.name} create #{f}" do
                path f
                action :nothing
                subscribes :delete, "package[#{new_resource.name} create #{new_resource.package_name}]", :immediately
              end
            end
          else
            %w(
              /etc/httpd/conf.d/autoindex.conf
              /etc/httpd/conf.d/README
              /etc/httpd/conf.d/notrace.conf
              /etc/httpd/conf.d/userdir.conf
              /etc/httpd/conf.d/welcome.conf
              /etc/httpd/conf.modules.d/00-base.conf
              /etc/httpd/conf.modules.d/00-dav.conf
              /etc/httpd/conf.modules.d/00-lua.conf
              /etc/httpd/conf.modules.d/00-mpm.conf
              /etc/httpd/conf.modules.d/00-proxy.conf
              /etc/httpd/conf.modules.d/00-systemd.conf
              /etc/httpd/conf.modules.d/01-cgi.conf
            ).each do |f|
              file "#{new_resource.name} create #{f}" do
                path f
                action :nothing
                subscribes :delete, "package[#{new_resource.name} create #{new_resource.package_name}]", :immediately
              end
            end
          end

          # FIXME: This is needed for serverspec.
          # Move into a serverspec recipe
          package "#{new_resource.name} create net-tools" do
            package_name 'net-tools'
            action :install
          end

          # achieve parity with modules statically compiled into
          # debian and ubuntu
          if new_resource.version.to_f < 2.4
            %w( log_config logio ).each do |m|
              httpd_module "#{new_resource.name} create #{m}" do
                module_name m
                httpd_version new_resource.version
                instance new_resource.instance
                notifies :reload, "service[#{new_resource.name} create #{apache_name}]"
                action :create
              end
            end
          else
            %w( log_config logio unixd version watchdog ).each do |m|
{'fraction_non_alphanumeric': 0.08802502234137623, 'fraction_numerical': 0.0032171581769436996, 'mean_word_length': 1.5833333333333333, 'pattern_counts': {'":': 0, '<': 69, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4139542', 'n_tokens_mistral': 3064, 'n_tokens_neox': 2930, 'n_words': 744}