From a8b69f5bd4f79a31963b50ae92127a25094419ab Mon Sep 17 00:00:00 2001 From: Henning Schild Date: Thu, 9 Jun 2022 16:10:03 +0200 Subject: [PATCH] libcmds: stop creating empty .wgetrc and .netrc Having empty files does not add any value. We do have a new HOME so files from the old HOME are not used anyways. And writing an empty .wgetrc will not disable the use of /etc/wgetrc. .netrc is supported by many tools in slightly different ways, but also here if there was a global config the one from HOME would likely be appended and would not prevent use of the global one. Signed-off-by: Henning Schild Signed-off-by: Jan Kiszka --- kas/libcmds.py | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/kas/libcmds.py b/kas/libcmds.py index 0a148f4..37d7fcb 100644 --- a/kas/libcmds.py +++ b/kas/libcmds.py @@ -167,17 +167,12 @@ class SetupHome(Command): return 'setup_home' def execute(self, ctx): - with open(self.tmpdirname + '/.wgetrc', 'w') as fds: - fds.write('\n') - with open(self.tmpdirname + '/.netrc', 'w') as fds: - # Configure the gitlab CI authentification token - if os.environ.get('CI_SERVER_HOST', False) \ - and os.environ.get('CI_JOB_TOKEN', False): + if os.environ.get('CI_SERVER_HOST', False) \ + and os.environ.get('CI_JOB_TOKEN', False): + with open(self.tmpdirname + '/.netrc', 'w') as fds: fds.write('machine ' + os.environ['CI_SERVER_HOST'] + '\n' 'login gitlab-ci-token\n' 'password ' + os.environ['CI_JOB_TOKEN'] + '\n') - else: - fds.write('\n') with open(self.tmpdirname + '/.gitconfig', 'w') as fds: fds.write('[User]\n' '\temail = kas@example.com\n'