Updated env file and kube config file handling
New:
- Imported kaas/* repositories (1100+)
- Options for use of specific configs (env and kaas)
Fixes:
- updated header index search
- fixed package name handling
- fixed --force-tag option
Change-Id: Ib51ea9a47db93d6dd0868c32cb389d70053af26c
Related-PROD: PROD-35903
diff --git a/cfg_checker/modules/packages/checker.py b/cfg_checker/modules/packages/checker.py
index b2e8194..46e98be 100644
--- a/cfg_checker/modules/packages/checker.py
+++ b/cfg_checker/modules/packages/checker.py
@@ -453,7 +453,7 @@
self.master = SaltNodes(config)
super(SaltCloudPackageChecker, self).__init__(
config,
- force_tag=None,
+ force_tag=force_tag,
exclude_keywords=[],
skip_list=None,
skip_list_file=None
@@ -472,7 +472,7 @@
self.master = KubeNodes(config)
super(KubeCloudPackageChecker, self).__init__(
config,
- force_tag=None,
+ force_tag=force_tag,
exclude_keywords=[],
skip_list=None,
skip_list_file=None
diff --git a/cfg_checker/modules/packages/repos.py b/cfg_checker/modules/packages/repos.py
index 824275d..1a040ff 100644
--- a/cfg_checker/modules/packages/repos.py
+++ b/cfg_checker/modules/packages/repos.py
@@ -50,13 +50,9 @@
_val = value
if header:
try:
- _ = next(filter(lambda i: _di[i]["header"] == header, _di))
- # iterator not empty, find index
- for _k, _v in _di.items():
- if _v["header"] == header:
- _index = _k
+ _index = next(i for i in _di if header in _di[i]['header'])
except StopIteration:
- _index = str(len(_di.keys()) + 1)
+ _index = str(len(_di) + 1)
_di[_index] = {
"header": header,
"props": _val
@@ -65,13 +61,10 @@
return _index
else:
try:
- _ = next(filter(lambda i: _di[i] == _val, _di))
+ _index = next(i for i in _di if _val in _di[i])
# iterator not empty, find index
- for _k, _v in _di.items():
- if _v == _val:
- _index = _k
except StopIteration:
- _index = str(len(_di.keys()) + 1)
+ _index = str(len(_di) + 1)
# on save, cast it as str
_di[_index] = _val
finally:
@@ -260,7 +253,7 @@
_total_index = len(_sub_tags)
_index = 0
_progress = Progress(_total_index)
- logger.debug(
+ logger_cli.debug(
"... found {} subtags for '{}'".format(
len(_sub_tags),
_label
@@ -270,7 +263,7 @@
for _stag in _sub_tags:
_u = _baseurl + _stag
_index += 1
- logger.debug(
+ logger_cli.debug(
"... searching repos in '{}/{}'".format(
_label,
_stag
@@ -278,13 +271,13 @@
)
# Searching Package collections
- if _stag in ubuntu_releases:
+ if _stag in ubuntu_releases or _stag.startswith("ubuntu-2020"):
# if stag is the release, this is all packages
_repo["all"][_stag] = []
_repo["all"]["url"] = _n_url(_u)
_path_list = self.search_pkg(_n_url(_u), [])
self._map_repo(_path_list, _repo["all"][_stag])
- logger.info(
+ logger_cli.info(
"-> found {} dists".format(
len(_repo["all"][_stag])
)
@@ -299,7 +292,7 @@
_releases, _ = self._ls_repo_page(_n_url(_u))
for _rel in _releases:
if _rel not in ubuntu_releases:
- logger.debug(
+ logger_cli.debug(
"... skipped unknown ubuntu release: "
"'{}' in '{}'".format(
_rel,
@@ -314,7 +307,7 @@
_path_list,
_repo[_stag][_rel]
)
- logger.info(
+ logger_cli.info(
"-> found {} dists for '{}'".format(
len(_repo[_stag][_rel]),
_rel
@@ -579,7 +572,7 @@
_other_repos = 0
for _c, _d in _info.items():
for _ur, _l in _d.items():
- if _ur in ubuntu_releases:
+ if _ur in ubuntu_releases or _ur.startswith("ubuntu-2020"):
_ubuntu_package_repos += len(_l)
elif _ur != 'url':
_other_repos += len(_l)
@@ -741,10 +734,16 @@
elif _line.startswith(' '):
_desc[_key] += "\n{}".format(_line)
else:
- _key = _line[:_line.index(':')]
- _value = _line[_line.index(':')+1:]
- _key = _key.lower()
+ if _line.endswith(":"):
+ _key = _line[:-1]
+ _value = ""
+ else:
+ _key, _value = _line.split(": ", 1)
+ # _key = _line[:_line.index(':')]
+ # _value = _line[_line.index(':')+1:]
+ # _value = _value if _value[0] != ' ' else _value[1:]
+ _key = _key.lower()
_desc[_key] = _value
# save descriptions if needed
if descriptions: