Merge "yum-config compose-repos generation improvements"
This commit is contained in:
commit
1684191df4
|
@ -15,6 +15,7 @@
|
|||
|
||||
import argparse
|
||||
import logging
|
||||
import os
|
||||
import sys
|
||||
|
||||
from tripleo_repos.utils import load_logging
|
||||
|
@ -277,7 +278,16 @@ def main():
|
|||
override_repos=args.disable_conflicting)
|
||||
if args.disable_repos:
|
||||
for file in args.disable_repos:
|
||||
repo_obj.update_all_sections(file, enabled=False)
|
||||
valid_path = None
|
||||
rel_path = os.path.join(args.config_dir_path, file)
|
||||
|
||||
if cfg.validated_file_path(file):
|
||||
valid_path = file
|
||||
elif cfg.validated_file_path(rel_path):
|
||||
valid_path = rel_path
|
||||
|
||||
if valid_path is not None:
|
||||
repo_obj.update_all_sections(valid_path, enabled=False)
|
||||
|
||||
|
||||
def cli_entrypoint():
|
||||
|
|
|
@ -159,7 +159,10 @@ class TripleOYumComposeRepoConfig(TripleOYumConfig):
|
|||
self.add_section(var.lower(), add_dict, file_path)
|
||||
except TripleOYumConfigInvalidSection:
|
||||
logging.debug("Section '%s' that already exists in this file. "
|
||||
"Skipping...", var)
|
||||
"Trying to update it...", var)
|
||||
self.update_section(var.lower(),
|
||||
set_dict=add_dict,
|
||||
file_path=file_path)
|
||||
# needed to override other repos
|
||||
updated_repos[var.lower()] = file_path
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ from __future__ import (absolute_import, division, print_function)
|
|||
|
||||
|
||||
__metaclass__ = type
|
||||
|
||||
DOCUMENTATION = r'''
|
||||
---
|
||||
module: yum_config
|
||||
|
@ -178,6 +179,8 @@ EXAMPLES = r'''
|
|||
|
||||
RETURN = r''' # '''
|
||||
|
||||
import os # noqa: E402
|
||||
|
||||
from ansible.module_utils import six # noqa: E402
|
||||
from ansible.module_utils.basic import AnsibleModule # noqa: E402
|
||||
|
||||
|
@ -316,7 +319,16 @@ def run_module():
|
|||
override_repos=module.params['disable_conflicting_variants'])
|
||||
# 3. Disable all repos provided in disable_repos
|
||||
for file in module.params['disable_repos']:
|
||||
repo_obj.update_all_sections(file, enabled=False)
|
||||
valid_path = None
|
||||
rel_path = os.path.join(module.params['dir_path'], file)
|
||||
|
||||
if cfg.validated_file_path(file):
|
||||
valid_path = file
|
||||
elif cfg.validated_file_path(rel_path):
|
||||
valid_path = rel_path
|
||||
|
||||
if valid_path is not None:
|
||||
repo_obj.update_all_sections(valid_path, enabled=False)
|
||||
|
||||
elif module.params['type'] == 'module':
|
||||
try:
|
||||
|
|
|
@ -181,6 +181,8 @@ class TestTripleoYumConfigMain(TestTripleoYumConfigBase):
|
|||
repos_obj, 'enable_compose_repos')
|
||||
mock_update_all = self.mock_object(
|
||||
repos_obj, 'update_all_sections')
|
||||
self.mock_object(yum_cfg, 'validated_file_path',
|
||||
mock.Mock(return_value=True))
|
||||
|
||||
main.main()
|
||||
|
||||
|
|
Loading…
Reference in New Issue