def download_cookbooks
      # first, if @download_path is world writable, stop that nonsense right this second.
      unless RightScale::Platform.windows?
        if File.exists?(@download_path) && File.world_writable?(@download_path)
          Log.warn("Cookbooks download path world writable; fixing.")
          File.chmod(0755, @download_path)
        end
      end

      unless CookState.download_once?
        Log.info("Deleting existing cookbooks")
        # second, wipe out any preexisting cookbooks in the download path
        if File.directory?(@download_path)
          Dir.foreach(@download_path) do |entry|
            FileUtils.remove_entry_secure(File.join(@download_path, entry)) if entry =~ /\A[[:xdigit:]]+\Z/
          end
        end
      end

      unless @cookbooks.empty?
        # only create audit output if we're actually going to download something!
        @audit.create_new_section('Retrieving cookbooks')
        audit_time do
          @cookbooks.each do |cookbook_sequence|
            cookbook_sequence.positions.each do |position|
              if @cookbook_repo_retriever.should_be_linked?(cookbook_sequence.hash, position.position)
                begin
                  @cookbook_repo_retriever.link(cookbook_sequence.hash, position.position)
                rescue Exception => e
                  ::RightScale::Log.error("Failed to link #{position.cookbook.name} for development", e)
                end
              else
                # download with repose
                cookbook_path = CookbookPathMapping.repose_path(@download_path, cookbook_sequence.hash, position.position)
                if File.exists?(cookbook_path)
                  @audit.append_info("Skipping #{position.cookbook.name}, already there")
                else
                  download_cookbook(cookbook_path, position.cookbook)
                end
              end
            end
          end
        end
      end

      # record that cookbooks have been downloaded so we do not download them again in Dev mode
      CookState.has_downloaded_cookbooks = true

      true
    rescue Exception => e
      report_failure("Failed to download cookbook", "Cannot continue due to #{e.class.name}: #{e.message}.")
      Log.debug(Log.format("Failed to download cookbook", e, :trace))
    end
def download_cookbooks
      # first, if @download_path is world writable, stop that nonsense right this second.
      unless RightScale::Platform.windows?
        if File.exists?(@download_path) && File.world_writable?(@download_path)
          Log.warn("Cookbooks download path world writable; fixing.")
          File.chmod(0755, @download_path)
        end
      end

      unless CookState.download_once?
        Log.info("Deleting existing cookbooks")
        # second, wipe out any preexisting cookbooks in the download path
        if File.directory?(@download_path)
          Dir.foreach(@download_path) do |entry|
            FileUtils.remove_entry_secure(File.join(@download_path, entry)) if entry =~ /\A[[:xdigit:]]+\Z/
          end
        end
      end

      unless @cookbooks.empty?
        # only create audit output if we're actually going to download something!
        @audit.create_new_section('Retrieving cookbooks')
        audit_time do
          @cookbooks.each do |cookbook_sequence|
            cookbook_sequence.positions.each do |position|
              if @cookbook_repo_retriever.should_be_linked?(cookbook_sequence.hash, position.position)
                begin
                  @cookbook_repo_retriever.link(cookbook_sequence.hash, position.position)
                rescue Exception => e
                  ::RightScale::Log.error("Failed to link #{position.cookbook.name} for development", e)
                end
              else
                # download with repose
                cookbook_path = CookbookPathMapping.repose_path(@download_path, cookbook_sequence.hash, position.position)
                if File.exists?(cookbook_path)
                  @audit.append_info("Skipping #{position.cookbook.name}, already there")
                else
                  download_cookbook(cookbook_path, position.cookbook)
                end
              end
            end
          end
        end
      end

      # record that cookbooks have been downloaded so we do not download them again in Dev mode
      CookState.has_downloaded_cookbooks = true

      true
    rescue Exception => e
      report_failure("Failed to download cookbook", "Cannot continue due to #{e.class.name}: #{e.message}.")
      Log.debug(Log.format("Failed to download cookbook", e, :trace))
    end
Download required cookbooks from Repose mirror; update @ok.
 Note: Starting with Chef 0.8, the cookbooks repositories list must be traversed in reverse
 order to preserve the semantic of the dashboard (first repo has priority)

 === Return
 true:: Always return true