# File lib/simp/cli/config/items/action/update_os_yum_repositories_action.rb, line 24
    def apply
      @applied_status = :failed
      @yum_update = :failed

      # set up yum repos
      @yumpath = File.join( @www_yum_dir,
                           Facter.value('operatingsystem'),
                           Facter.value('operatingsystemrelease'),
                           Facter.value('architecture')
                         )
      debug( "Updating YUM Updates repository at #{File.join(@yumpath, 'Updates')}" )
      begin
        Dir.chdir(@yumpath) do
          FileUtils.mkdir('Updates') unless File.directory?('Updates')
          Dir.chdir('Updates') do
            execute( %q(find .. -type f -name '*.rpm' -exec ln -sf {} \\;) )
            cmd = 'createrepo -q -p --update .'
            result = show_wait_spinner {
              execute(cmd)
            }
            raise YumRepoError.new("'#{cmd}' failed in #{Dir.pwd}") unless result
          end
        end
        result = execute("chown -R root:apache #{@www_yum_dir}/")
        result = result && execute("chmod -R u=rwX,g=rX,o-rwx #{@www_yum_dir}/")
        raise YumRepoError.new("Updating ownership and permissions of #{@www_yum_dir}/ failed!")  unless result
        @yum_update = :succeeded
        debug( "Finished updating Updates repository" )
      rescue YumRepoError, Errno::ENOENT, Errno::ENOTDIR, Errno::EACCES, Errno::EEXIST => err
        error( "\nERROR: Something went wrong setting up the Updates repo in #{@yumpath}!", [:RED] )
        error( '       Please make sure your Updates repo is properly configured.', [:RED] )
        error( "       Error output: #{err.class} - #{err}", [:RED] )
      end

      @yum_repo_disable = :failed
      begin
        Dir.chdir( @yum_repos_d ) do
          # disable any CentOS repo spam
          if ! Dir.glob('CentOS*.repo').empty?
            debug( "Disabling CentOS repositories in #{@yum_repos_d}" )
            execute( %q{grep "\\[*\\]" *CentOS*.repo | cut -d "[" -f2 | cut -d "]" -f1 | xargs yum-config-manager --disable} )
            debug( "Finished disabling CentOS repositories" )
          end
        end
        @yum_repo_disable = :succeeded
      rescue Errno::ENOENT, Errno::ENOTDIR, Errno::EACCES => err
        error( "\nERROR: Disabling of CentOS repositories failed: #{err.class} - #{err}", [:RED] )
      end
      @applied_status = :succeeded if (@yum_update == :succeeded) and (@yum_repo_disable == :succeeded)
    end