# File lib/simp/cli/config/items/action/set_production_to_simp_action.rb, line 41
    def set_primary_environment
      success = false
      production_path = File.join(@primary_env_path, 'production')
      simp_environment_path = File.join(@primary_env_path, 'simp')
      if File.exists?(@primary_env_path)
        if Dir.exists?(simp_environment_path)
          if File.exists?(production_path)
            if File.symlink?(production_path)
              debug( "Switching #{production_path} symlink to #{simp_environment_path}" )
              FileUtils.rm(production_path)
              Dir.chdir(@primary_env_path) do
                File.symlink('simp', 'production')
              end
              success = true
            else
              # have to backup outside of the normal environments directory, or installations
              # running R10K are likely to remove the backup
              backup_dir = "#{@primary_env_path}.bak"
              FileUtils.mkdir_p(backup_dir)
              group_id = File.stat(@primary_env_path).gid
              File.chown(nil, group_id, backup_dir)
              backup = File.join(backup_dir, "production.#{@start_time.strftime('%Y%m%dT%H%M%S')}")
              debug( "Backing up #{production_path} to #{backup}" )
              FileUtils.mv(production_path, backup)
  
              debug( "Linking #{production_path} to #{simp_environment_path}" )
              Dir.chdir(@primary_env_path) do
                File.symlink('simp', 'production')
              end
              success = true
            end
          else
            debug( "Linking #{production_path} to #{simp_environment_path}" )
            Dir.chdir(@primary_env_path) do
              File.symlink('simp', 'production')
            end
            success = true
          end
        else
          error( "\nERROR: 'simp' environment path not found: #{simp_environment_path}", [:RED] )
        end
      else
        error( "\nERROR: environments path not found: #{@primary_env_path}", [:RED] )
      end
      success
    end