mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
copr: add includepkgs functionality (#8779)
* Limit package for Copr using includepkgs * Limit package for Copr using includepkgs * Limit package for Copr using includepkgs * Limit package for Copr using includepkgs * Limit package for Copr using includepkgs * Added changes in copr module * Excludepkgs parameter add * Update module and params to handle a list + Docs updated * Update module and params to handle a list + Docs updated
This commit is contained in:
parent
e9071e9871
commit
96d5e6e50e
2 changed files with 22 additions and 0 deletions
2
changelogs/fragments/8738-limit-packages-for-copr.yml
Normal file
2
changelogs/fragments/8738-limit-packages-for-copr.yml
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
minor_changes:
|
||||||
|
- copr - Added ``includepkgs`` and ``excludepkgs`` parameters to limit the list of packages fetched or excluded from the repository(https://github.com/ansible-collections/community.general/pull/8779).
|
|
@ -52,6 +52,18 @@ options:
|
||||||
for example V(epel-7-x86_64). Default chroot is determined by the operating system,
|
for example V(epel-7-x86_64). Default chroot is determined by the operating system,
|
||||||
version of the operating system, and architecture on which the module is run.
|
version of the operating system, and architecture on which the module is run.
|
||||||
type: str
|
type: str
|
||||||
|
includepkgs:
|
||||||
|
description: List of packages to include.
|
||||||
|
required: false
|
||||||
|
type: list
|
||||||
|
elements: str
|
||||||
|
version_added: 9.4.0
|
||||||
|
excludepkgs:
|
||||||
|
description: List of packages to exclude.
|
||||||
|
required: false
|
||||||
|
type: list
|
||||||
|
elements: str
|
||||||
|
version_added: 9.4.0
|
||||||
"""
|
"""
|
||||||
|
|
||||||
EXAMPLES = r"""
|
EXAMPLES = r"""
|
||||||
|
@ -255,6 +267,12 @@ class CoprModule(object):
|
||||||
"""
|
"""
|
||||||
if not repo_content:
|
if not repo_content:
|
||||||
repo_content = self._download_repo_info()
|
repo_content = self._download_repo_info()
|
||||||
|
if self.ansible_module.params["includepkgs"]:
|
||||||
|
includepkgs_value = ','.join(self.ansible_module.params['includepkgs'])
|
||||||
|
repo_content = repo_content.rstrip('\n') + '\nincludepkgs={0}\n'.format(includepkgs_value)
|
||||||
|
if self.ansible_module.params["excludepkgs"]:
|
||||||
|
excludepkgs_value = ','.join(self.ansible_module.params['excludepkgs'])
|
||||||
|
repo_content = repo_content.rstrip('\n') + '\nexcludepkgs={0}\n'.format(excludepkgs_value)
|
||||||
if self._compare_repo_content(repo_filename_path, repo_content):
|
if self._compare_repo_content(repo_filename_path, repo_content):
|
||||||
return False
|
return False
|
||||||
if not self.check_mode:
|
if not self.check_mode:
|
||||||
|
@ -470,6 +488,8 @@ def run_module():
|
||||||
name=dict(type="str", required=True),
|
name=dict(type="str", required=True),
|
||||||
state=dict(type="str", choices=["enabled", "disabled", "absent"], default="enabled"),
|
state=dict(type="str", choices=["enabled", "disabled", "absent"], default="enabled"),
|
||||||
chroot=dict(type="str"),
|
chroot=dict(type="str"),
|
||||||
|
includepkgs=dict(type='list', elements="str", required=False),
|
||||||
|
excludepkgs=dict(type='list', elements="str", required=False),
|
||||||
)
|
)
|
||||||
module = AnsibleModule(argument_spec=module_args, supports_check_mode=True)
|
module = AnsibleModule(argument_spec=module_args, supports_check_mode=True)
|
||||||
params = module.params
|
params = module.params
|
||||||
|
|
Loading…
Reference in a new issue