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

class Chef
  class Provider
    class MysqlServiceBase < Chef::Provider::LWRPBase
      use_inline_resources if defined?(use_inline_resources)

      def whyrun_supported?
        true
      end

      # Mix in helpers from libraries/helpers.rb
      include MysqlCookbook::Helpers

      # Service related methods referred to in the :create and :delete
      # actions need to be implemented in the init system subclasses.
      #
      # create_stop_system_service
      # delete_stop_service

      # All other methods are found in libraries/helpers.rb
      #
      # etc_dir, run_dir, log_dir, etc

      action :create do
        # Yum, Apt, etc. From helpers.rb
        configure_package_repositories

        # Software installation
        package "#{new_resource.name} :create #{server_package_name}" do
          package_name server_package_name
          version parsed_version if node['platform'] == 'smartos'
          version new_resource.package_version
          action new_resource.package_action
        end

        create_stop_system_service

        # Apparmor
        configure_apparmor

        # System users
        group "#{new_resource.name} :create mysql" do
          group_name 'mysql'
          action :create
        end

        user "#{new_resource.name} :create mysql" do
          username 'mysql'
          gid 'mysql'
          action :create
        end

        # Yak shaving secion. Account for random errata.
        #
        # Turns out that mysqld is hard coded to try and read
        # /etc/mysql/my.cnf, and its presence causes problems when
        # setting up multiple services.
        file "#{new_resource.name} :create #{prefix_dir}/etc/mysql/my.cnf" do
          path "#{prefix_dir}/etc/mysql/my.cnf"
          action :delete
        end

        file "#{new_resource.name} :create #{prefix_dir}/etc/my.cnf" do
          path "#{prefix_dir}/etc/my.cnf"
          action :delete
        end

        # mysql_install_db is broken on 5.6.13
        link "#{new_resource.name} :create #{prefix_dir}/usr/share/my-default.cnf" do
          target_file "#{prefix_dir}/usr/share/my-default.cnf"
          to "#{etc_dir}/my.cnf"
          action :create
        end

        # Support directories
        directory "#{new_resource.name} :create #{etc_dir}" do
          path etc_dir
          owner new_resource.run_user
          group new_resource.run_group
          mode '0750'
          recursive true
          action :create
        end
<commit_msg>Update provider_mysql_service_base.rb<commit_after>require 'chef/provider/lwrp_base'
require_relative 'helpers'

class Chef
  class Provider
    class MysqlServiceBase < Chef::Provider::LWRPBase
      use_inline_resources if defined?(use_inline_resources)

      def whyrun_supported?
        true
      end

      # Mix in helpers from libraries/helpers.rb
      include MysqlCookbook::Helpers

      # Service related methods referred to in the :create and :delete
      # actions need to be implemented in the init system subclasses.
      #
      # create_stop_system_service
      # delete_stop_service

      # All other methods are found in libraries/helpers.rb
      #
      # etc_dir, run_dir, log_dir, etc

      action :create do
        # Yum, Apt, etc. From helpers.rb
        configure_package_repositories

        # Software installation
        package "#{new_resource.name} :create #{server_package_name}" do
          package_name server_package_name
          version parsed_version if node['platform'] == 'smartos'
          version new_resource.package_version
          action new_resource.package_action
        end

        create_stop_system_service

        # Apparmor
        configure_apparmor

        # System users
        group "#{new_resource.name} :create mysql" do
          group_name 'mysql'
          action :create
        end

        user "#{new_resource.name} :create mysql" do
          username 'mysql'
          gid 'mysql'
          action :create
        end

        # Yak shaving secion. Account for random errata.
        #
        # Turns out that mysqld is hard coded to try and read
        # /etc/mysql/my.cnf, and its presence causes problems when
        # setting up multiple services.
        file "#{new_resource.name} :create #{prefix_dir}/etc/mysql/my.cnf" do
          path "#{prefix_dir}/etc/mysql/my.cnf"
          action :delete
        end

        file "#{new_resource.name} :create #{prefix_dir}/etc/my.cnf" do
          path "#{prefix_dir}/etc/my.cnf"
          action :delete
        end

        # mysql_install_db is broken on 5.6.13
        link "#{new_resource.name} :create #{prefix_dir}/usr/share/my-default.cnf" do
          target_file "#{prefix_dir}/usr/share/my-default.cnf"
          to "#{etc_dir}/my.cnf"
          action :create
        end

        # Support directories
        directory "#{new_resource.name} :create #{etc_dir}" do
          path etc_dir
          owner new_resource.run_user
          group new_resource.run_group
          mode '0750'
          recursive true
          action :create
        end
        
         # Support directories
        directory "#{new_resource.name} :create #{etc_dir}" do
          path etc_dir
          owner new_resource.run_user
          group new_resource.run_group
          mode '0750'
          recursive true
          action :create
        end
        
         # Support directories
        directory "#{new_resource.name} :create #{etc_dir}" do
          path etc_dir
          owner new_resource.run_user
          group new_resource.run_group
          mode '0750'
          recursive true
          action :create
        end
        
         # Support directories
        directory "#{new_resource.name} :create #{etc_dir}" do
          path etc_dir
          owner new_resource.run_user
          group new_resource.run_group
          mode '0750'
          recursive true
          action :create
        end
        
         # Support directories
        directory "#{new_resource.name} :create #{etc_dir}" do
          path etc_dir
          owner new_resource.run_user
          group new_resource.run_group
          mode '0750'
          recursive true
          action :create
        end
        
         # Support directories
        directory "#{new_resource.name} :create #{etc_dir}" do
          path etc_dir
          owner new_resource.run_user
          group new_resource.run_group
          mode '0750'
          recursive true
          action :create
        end
        
         # Support directories
        directory "#{new_resource.name} :create #{etc_dir}" do
          path etc_dir
          owner new_resource.run_user
          group new_resource.run_group
          mode '0750'
          recursive true
          action :create
        end
        
         # Support directories
        directory "#{new_resource.name} :create #{etc_dir}" do
          path etc_dir
          owner new_resource.run_user
          group new_resource.run_group
          mode '0750'
          recursive true
          action :create
        end
        
         # Support directories
        directory "#{new_resource.name} :create #{etc_dir}" do
          path etc_dir
          owner new_resource.run_user
          group new_resource.run_group
          mode '0750'
          recursive true
          action :create
        end
        
         # Support directories
        directory "#{new_resource.name} :create #{etc_dir}" do
          path etc_dir
          owner new_resource.run_user
          group new_resource.run_group
          mode '0750'
          recursive true
          action :create
        end

{'fraction_non_alphanumeric': 0.07042616196729753, 'fraction_numerical': 0.0066949916312604605, 'mean_word_length': 1.8443793482240938, 'pattern_counts': {'":': 0, '<': 5, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2636599', 'n_tokens_mistral': 2173, 'n_tokens_neox': 2097, 'n_words': 579}