mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Allow for creating yum repo based on metalink only (#30736)
This commit is contained in:
parent
c3d226a739
commit
8b416abb49
1 changed files with 10 additions and 6 deletions
|
@ -49,7 +49,7 @@ options:
|
||||||
- URL to the directory where the yum repository's 'repodata' directory
|
- URL to the directory where the yum repository's 'repodata' directory
|
||||||
lives.
|
lives.
|
||||||
- It can also be a list of multiple URLs.
|
- It can also be a list of multiple URLs.
|
||||||
- This or the I(mirrorlist) parameter is required if I(state) is set to
|
- This, the I(metalink) or I(mirrorlist) parameters are required if I(state) is set to
|
||||||
C(present).
|
C(present).
|
||||||
cost:
|
cost:
|
||||||
required: false
|
required: false
|
||||||
|
@ -219,12 +219,14 @@ options:
|
||||||
- Specifies a URL to a metalink file for the repomd.xml, a list of
|
- Specifies a URL to a metalink file for the repomd.xml, a list of
|
||||||
mirrors for the entire repository are generated by converting the
|
mirrors for the entire repository are generated by converting the
|
||||||
mirrors for the repomd.xml file to a I(baseurl).
|
mirrors for the repomd.xml file to a I(baseurl).
|
||||||
|
- This, the I(baseurl) or I(mirrorlist) parameters are required if I(state) is set to
|
||||||
|
C(present).
|
||||||
mirrorlist:
|
mirrorlist:
|
||||||
required: false
|
required: false
|
||||||
default: null
|
default: null
|
||||||
description:
|
description:
|
||||||
- Specifies a URL to a file containing a list of baseurls.
|
- Specifies a URL to a file containing a list of baseurls.
|
||||||
- This or the I(baseurl) parameter is required if I(state) is set to
|
- This, the I(baseurl) or I(metalink) parameters are required if I(state) is set to
|
||||||
C(present).
|
C(present).
|
||||||
mirrorlist_expire:
|
mirrorlist_expire:
|
||||||
required: false
|
required: false
|
||||||
|
@ -563,10 +565,11 @@ class YumRepo(object):
|
||||||
# Baseurl/mirrorlist is not required because for removal we need only
|
# Baseurl/mirrorlist is not required because for removal we need only
|
||||||
# the repo name. This is why we check if the baseurl/mirrorlist is
|
# the repo name. This is why we check if the baseurl/mirrorlist is
|
||||||
# defined.
|
# defined.
|
||||||
if (self.params['baseurl'], self.params['mirrorlist']) == (None, None):
|
req_params = (self.params['baseurl'], self.params['metalink'], self.params['mirrorlist'])
|
||||||
|
if req_params == (None, None, None):
|
||||||
self.module.fail_json(
|
self.module.fail_json(
|
||||||
msg='Parameter "baseurl" or "mirrorlist" is required for '
|
msg="Parameter 'baseurl', 'metalink' or 'mirrorlist' is required for "
|
||||||
'adding a new repo.')
|
"adding a new repo.")
|
||||||
|
|
||||||
# Set options
|
# Set options
|
||||||
for key, value in sorted(self.params.items()):
|
for key, value in sorted(self.params.items()):
|
||||||
|
@ -709,9 +712,10 @@ def main():
|
||||||
if state == 'present':
|
if state == 'present':
|
||||||
if (
|
if (
|
||||||
module.params['baseurl'] is None and
|
module.params['baseurl'] is None and
|
||||||
|
module.params['metalink'] is None and
|
||||||
module.params['mirrorlist'] is None):
|
module.params['mirrorlist'] is None):
|
||||||
module.fail_json(
|
module.fail_json(
|
||||||
msg="Parameter 'baseurl' or 'mirrorlist' is required.")
|
msg="Parameter 'baseurl', 'metalink' or 'mirrorlist' is required.")
|
||||||
if module.params['description'] is None:
|
if module.params['description'] is None:
|
||||||
module.fail_json(
|
module.fail_json(
|
||||||
msg="Parameter 'description' is required.")
|
msg="Parameter 'description' is required.")
|
||||||
|
|
Loading…
Reference in a new issue