Skip to content

Commit

Permalink
answerfile: support *gpgcheck override for each <source>
Browse files Browse the repository at this point in the history
Global *gpgcheck flag can change the default from True to False, and these
new flags allow to override this default on a per-source basis.

Signed-off-by: Yann Dirson <[email protected]>
  • Loading branch information
ydirson committed Mar 6, 2023
1 parent afdbe02 commit 22c5b0b
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
16 changes: 15 additions & 1 deletion answerfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,21 @@ def parseSource(self):
if rtype == 'url':
address = util.URL(address)

results['sources'].append({'media': rtype, 'address': address})
# workaround getBoolAttribute() not allowing "None" as
# default, by using a getStrAttribute() call first to
# handle the default situation where the attribute is not
# specified
repo_gpgcheck = (None if getStrAttribute(i, ['repo-gpgcheck'], default=None) is None
else getBoolAttribute(i, ['repo-gpgcheck']))
gpgcheck = (None if getStrAttribute(i, ['gpgcheck'], default=None) is None
else getBoolAttribute(i, ['gpgcheck']))

results['sources'].append({
'media': rtype, 'address': address,
'repo_gpgcheck': repo_gpgcheck,
'gpgcheck': gpgcheck,
})
logger.log("parsed source %s" % results['sources'][-1])

return results

Expand Down
6 changes: 4 additions & 2 deletions backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,8 +395,10 @@ def add_repos(main_repositories, update_repositories, repos):
for i in answers_pristine['sources']:
repos = repository.repositoriesFromDefinition(i['media'], i['address'])
add_repos(main_repositories, update_repositories, repos)
repo_gpgcheck = answers.get('repo-gpgcheck', True)
gpgcheck = answers.get('gpgcheck', True)
repo_gpgcheck = (answers.get('repo-gpgcheck', True) if i['repo_gpgcheck'] is None
else i['repo_gpgcheck'])
gpgcheck = (answers.get('gpgcheck', True) if i['gpgcheck'] is None
else i['gpgcheck'])
for repo in repos:
if repo in main_repositories:
repo.setRepoGpgCheck(repo_gpgcheck)
Expand Down
9 changes: 9 additions & 0 deletions doc/answerfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,15 @@ Elements for 'installation' modes
The location of the installation repository or a Supplemental
Pack. There may be multiple 'source' elements.

Optional attributes for <source> only:

repo-gpgcheck=bool
gpgcheck=bool

Override the global yum gpgcheck setting, respectively for
repodata and RPMs, for this source only. Only applies to
repositories that are not Supplemental Packs (none of which
are checked).

<bootloader location="mbr|partition">grub2|extlinux[D]|grub[D]</bootloader>?

Expand Down

0 comments on commit 22c5b0b

Please sign in to comment.