in Linux_scripts/rhui-check/rhui-check.py [0:0]
def check_rhui_repo_file(path):
"""
Handling the consistency of the Red Hat repositories
path: Indicates where the rhui repo is stored.
returns: A RHUI repository configuration stored in a configparser structure, each repository is a section.
"""
logger.debug('Entering check_rhui_repo_file()')
logger.debug('RHUI repo file is {}'.format(path))
try:
reposconfig = localParser()
try:
with open(path) as stream:
reposconfig.read_string('[default]\n' + stream.read())
except AttributeError:
reposconfig.add_section('[default]')
reposconfig.read(path)
logger.debug('{}'.format(str(reposconfig.sections())))
return reposconfig
except configparser.ParsingError:
logger.critical('{} does not follow standard REPO config format, reinstall the RHUI rpm and try again.'.format(path))
exit(1)