Added question

This commit is contained in:
Dimitris Zlatanidis 2024-05-01 22:55:55 +03:00
parent a8b68904ff
commit 134035fbdb

View file

@ -38,6 +38,9 @@ class UpdateRepositories(Configs): # pylint: disable=[R0902]
self.repos_for_update: dict = {}
self.option_for_yes: bool = self.utils.is_option(
('-y', '--yes'), flags)
def repositories(self) -> None:
""" Checks and call the repositories for update.
"""
@ -58,15 +61,18 @@ class UpdateRepositories(Configs): # pylint: disable=[R0902]
mirror (str): Repository GPG mirror key.
"""
if self.gpg_verification:
gpg_key: str = f'{mirror}GPG-KEYa'
gpg_key: str = f'{mirror}GPG-KEY'
gpg_command: str = 'gpg --fetch-key'
process: str = ''
try:
process = subprocess.run(f'{gpg_command} {gpg_key}', shell=True, stdout=subprocess.PIPE,
stderr=subprocess.STDOUT, encoding='utf-8', text=True, check=True)
except subprocess.CalledProcessError as e:
print(f'Getting GPG key: {self.bred}Failed{self.endc}\n')
raise SystemExit(2) from e
except subprocess.CalledProcessError:
print(f'Getting GPG key: {self.bred}Failed{self.endc}')
if not self.option_for_yes and self.ask_question:
self.view.question()
return
output: str = re.split(r"/|\s", process.stdout)
if process.returncode == 0 and 'imported:' in output: