diff --git a/src/ansible_navigator/data/image_introspect.py b/src/ansible_navigator/data/image_introspect.py index bd458a03a8..5d04b2bc17 100644 --- a/src/ansible_navigator/data/image_introspect.py +++ b/src/ansible_navigator/data/image_introspect.py @@ -195,6 +195,19 @@ def splitter(self, lines, line_split, section_delim=None): result[current_key] = value continue current_key = key.lower().replace("_", "-").strip() + if current_key == "description": + description = [] + while lines: + line = lines.pop(0) + if line == section_delim: + break + description.append(line) + if description: + result[current_key] = " ".join(description) + else: + result[current_key] = "No description available" + results.append(result) + return result value = content result[current_key] = value @@ -370,28 +383,8 @@ def parse(self, command): parsed = [] for package in packages: - entry = {} - while package: - line = package.pop(0) - left, _delim, right = self.re_partition(line, ":") - key = left.lower().replace("_", "-").strip() - - # Description is at the end of the package section - # read until package is empty - if key == "description": - description = [] - while package: - description.append(package.pop(0)) - # Normalize the data, in the case description is totally empty - if description: - entry[key] = "\n".join(description) - else: - entry[key] = "No description available" - parsed.append(entry) - # other package details are 1 line each - else: - value = self._strip(right) - entry[key] = value + result = self.splitter(package, line_split=":", section_delim="---") + parsed.append(result) command.details = parsed