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

      if File.exist?(@file)
         backup_file = "#{@file}.#{@start_time.strftime('%Y%m%dT%H%M%S')}"
         debug( "Backing up #{@file} to #{backup_file}" )
         FileUtils.cp(@file, backup_file)
         group_id = File.stat(@file).gid
         File.chown(nil, group_id, backup_file)
      end

      write_hieradata_yaml_file( @file, @config_items ) if @config_items.size > 0
      FileUtils.chmod(0640, @file)
      begin
        FileUtils.chown(nil, @group, @file)
        @applied_status = :succeeded
      rescue Errno::EPERM, ArgumentError => e
        # This will happen if the user is not root or the group does
        # not exist.
        error( "\nERROR: Could not change ownership of\n    #{@file} to '#{@group}' group", [:RED] )
      end
    end