Fixes after live cloud run
- ping, proper handling of multiple IPs on one interface
- node skips accounted on gathering linux versions
- '--force-tag' option for package report
- '--exclude-keywords' option for package report
- 'versions' foldereincluded on 'setup.py install'
Change-Id: I5e1b84f187270789223d50887d9d5d5cb78ee5ba
Related-PROD: PROD-28199
diff --git a/cfg_checker/modules/packages/checker.py b/cfg_checker/modules/packages/checker.py
index c37ecee..972b12f 100644
--- a/cfg_checker/modules/packages/checker.py
+++ b/cfg_checker/modules/packages/checker.py
@@ -11,7 +11,7 @@
class CloudPackageChecker(object):
- def __init__(self):
+ def __init__(self, force_tag=None, exclude_keywords=[]):
# Init salt master info
if not salt_master.nodes:
salt_master.nodes = salt_master.get_nodes()
@@ -29,6 +29,9 @@
)
)
+ self.force_tag = force_tag
+ self.exclude_repos_keywords = exclude_keywords
+
@staticmethod
def presort_packages(all_packages, full=None):
logger_cli.info("-> Presorting packages")
@@ -144,7 +147,7 @@
for key in salt_master.nodes.keys():
# due to much data to be passed from salt, it is happening in order
- if key in _result:
+ if key in _result and _result[key]:
_text = _result[key]
try:
_dict = json.loads(_text[_text.find('{'):])
@@ -174,13 +177,23 @@
"""
# Preload OpenStack release versions
_desc = PkgVersions()
-
logger_cli.info(
"# Cross-comparing: Installed vs Candidates vs Release"
)
# shortcuts for this cloud values
_os = salt_master.openstack_release
_mcp = salt_master.mcp_release
+ _t = [self.force_tag] if self.force_tag else []
+ _t.append(_mcp)
+
+ logger_cli.info("# Tag search list: {}".format(", ".join(_t)))
+ logger_cli.info("# Openstack version: {}".format(_os))
+ logger_cli.info(
+ "# Release versions repos keyword exclude list: {}".format(
+ ", ".join(self.exclude_repos_keywords)
+ )
+ )
+
# Progress class
_progress = Progress(len(salt_master.nodes.keys()))
_progress_index = 0
@@ -211,14 +224,42 @@
# get node attributes
_linux = salt_master.nodes[node_name]['linux_codename']
_arch = salt_master.nodes[node_name]['linux_arch']
- # get versions for this tag and repo headers
- # excluding 'nightly' repos
- _r = self.rm.get_filtered_versions(
- _name,
- tag=_mcp,
- include=[_os, _linux, _arch],
- exclude=["nightly"]
- )
+ # get versions for tag, Openstack release and repo headers
+ # excluding 'nightly' repos by default
+ _r = {}
+ # if there is a forced tag = use it
+ if self.force_tag:
+ _r = self.rm.get_filtered_versions(
+ _name,
+ tag=self.force_tag,
+ include=[_os, _linux, _arch],
+ exclude=self.exclude_repos_keywords
+ )
+ # if nothing found, look everywhere
+ if not _r:
+ _r = self.rm.get_filtered_versions(
+ _name,
+ tag=self.force_tag,
+ include=[_linux, _arch],
+ exclude=self.exclude_repos_keywords
+ )
+ # if nothing is found at this point,
+ # repeat search using normal tags
+ if not _r:
+ _r = self.rm.get_filtered_versions(
+ _name,
+ tag=_mcp,
+ include=[_os, _linux, _arch],
+ exclude=self.exclude_repos_keywords
+ )
+ # Once again, if nothing found, look everywhere
+ if not _r:
+ _r = self.rm.get_filtered_versions(
+ _name,
+ tag=_mcp,
+ include=[_linux, _arch],
+ exclude=self.exclude_repos_keywords
+ )
# repack versions in flat format
_vs = {}
_sections = {}