from pathlib import Path
# Own modules
-from fb_tools.common import is_sequence
+from fb_tools.common import is_sequence, pp
from fb_tools.obj import FbGenericBaseObject
from fb_tools.collections import CIStringSet
from fb_tools.multi_config import MultiConfigError, BaseMultiConfig
self.cobbler_ws_docroot = self.default_cobbler_ws_docroot
self.cobbler_ws_rel_filesdir = self.default_cobbler_ws_rel_filesdir
self.cobbler_distros = {}
+ self.cobbler_repos = {}
self.current_distro = None
def eval_section(self, section_name):
re_cobbler_distros = re.compile(r'^\s*cobbler[_-]?distros\s*$', re.IGNORECASE)
+ re_cobbler_repos = re.compile(r'^\s*cobbler[_-]?repos\s*$', re.IGNORECASE)
LOG.debug(_("Evaluating section {!r} ...").format(section_name))
if re_cobbler_distros.match(section_name):
self._eval_cobbler_distros(section_name, section)
return
+ if re_cobbler_repos.match(section_name):
+ self._eval_cobbler_repos(section_name, section)
+ return
if self.verbose > 1:
LOG.debug(_("Unhandled configuration section {!r}.").format(section_name))
return pwd_hash
+ # -------------------------------------------------------------------------
+ def _eval_cobbler_repos(self, section_name, section):
+
+ if self.verbose > 1:
+ LOG.debug(_("Checking config section {!r} ...").format(section_name))
+
+ for full_repo_name in section.keys():
+ repo_data = section[full_repo_name]
+ if isinstance(repo_data, dict):
+ repo_info = {}
+ if self.verbose > 2:
+ LOG.debug(_("Found Cobbler repository {!r}.").format(full_repo_name))
+ for key in repo_data.keys():
+ value = repo_data[key]
+ if key.lower() == 'reponame' and value.strip() != '':
+ repo_info['reponame'] = value.strip()
+ continue
+ if key.lower() == 'filename' and value.strip() != '':
+ repo_info['filename'] = value.strip()
+ continue
+ self.cobbler_repos[full_repo_name] = repo_info
+ if self.verbose > 3:
+ LOG.debug(_("Evaluated Cobbler repositories:") + '\n' + pp(self.cobbler_repos))
+
# =============================================================================
if __name__ == "__main__":