Skip to content

Commit

Permalink
Merge pull request #651 from gerrod3/fake-netrc
Browse files Browse the repository at this point in the history
Remove 'missing netrc' log messages when syncing

(cherry picked from commit 9befa23)
  • Loading branch information
gerrod3 authored and patchback[bot] committed Apr 11, 2024
1 parent eb29ea7 commit d51de54
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pulp_python/app/tasks/sync.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import logging
import tempfile

from aiohttp import ClientResponseError, ClientError
from lxml.etree import LxmlError
from gettext import gettext as _
from os import environ, path
from os import environ

from rest_framework import serializers

Expand Down Expand Up @@ -111,9 +112,10 @@ async def run(self):
"""
If includes is specified, then only sync those,else try to sync all other packages
"""
# Prevent bandersnatch from reading actual .netrc file, set to nonexistent file
# Prevent bandersnatch from reading actual .netrc file, set to empty file
# See discussion on https://github.com/pulp/pulp_python/issues/581
environ["NETRC"] = f"{path.curdir}/.fake-netrc"
fake_netrc = tempfile.NamedTemporaryFile(dir=".", delete=False)
environ["NETRC"] = fake_netrc.name
# TODO Change Bandersnatch internal API to take proxy settings in from config parameters
if proxy_url := self.remote.proxy_url:
if self.remote.proxy_username or self.remote.proxy_password:
Expand Down

0 comments on commit d51de54

Please sign in to comment.