Skip to content

Commit

Permalink
Evolve fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
ilia1243 committed Jan 16, 2024
1 parent d426822 commit f32d388
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 14 deletions.
4 changes: 2 additions & 2 deletions kubemarine/core/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -746,9 +746,9 @@ def evolve(self) -> None:
This allows to perform iterative changes in the cluster by sequentially applying the procedure enrichment.
"""
if EnrichmentStage.PROCEDURE in self._enrichment_products:
self._inventory = deepcopy(self.formatted_inventory)

procedure_products = self._enrichment_products.pop(EnrichmentStage.PROCEDURE)
self._inventory = deepcopy(procedure_products.formatted_inventory)

self._enrichment_products[EnrichmentStage.DEFAULT] = dataclasses.replace(
procedure_products, procedure_inventory=None, context=None)

Expand Down
4 changes: 2 additions & 2 deletions kubemarine/core/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def __init__(self, context: dict) -> None:
The context can be mutable, but only from action to action.
If the changes are aimed to change the enrichment process, one should call DynamicResources.reset_context().
"""
self.result_context = {}
self.result_context: dict = {}
"""
Context that holds the aggregated result of the execution through the sequence of actions.
"""
Expand Down Expand Up @@ -260,7 +260,7 @@ def collect_action_result(self) -> None:
if procedure_context is None:
return

procedure_context = {k: deepcopy(procedure_context[k])
procedure_context = {k: procedure_context[k]
for k in self.context['result']
if k in procedure_context}
default_merger.merge(self.result_context, procedure_context)
Expand Down
11 changes: 5 additions & 6 deletions kubemarine/procedures/check_iaas.py
Original file line number Diff line number Diff line change
Expand Up @@ -1259,11 +1259,11 @@ def vips_connectivity(cluster: KubernetesCluster) -> None:
tc.success(results='Connected')


def make_reports(context: dict) -> None:
def make_reports(context: dict, testsuite: TestSuite) -> None:
if not context['execution_arguments'].get('disable_csv_report', False):
context['testsuite'].save_csv(context['execution_arguments']['csv_report'], context['execution_arguments']['csv_report_delimiter'])
testsuite.save_csv(context['execution_arguments']['csv_report'], context['execution_arguments']['csv_report_delimiter'])
if not context['execution_arguments'].get('disable_html_report', False):
context['testsuite'].save_html(context['execution_arguments']['html_report'], context['initial_procedure'].upper())
testsuite.save_html(context['execution_arguments']['html_report'], context['initial_procedure'].upper())


tasks = OrderedDict({
Expand Down Expand Up @@ -1369,14 +1369,13 @@ def main(cli_arguments: List[str] = None) -> TestSuite:
flow_ = flow.ActionsFlow([IaasAction()])
result = flow_.run_flow(context, print_summary=False)

context = result.context
testsuite: TestSuite = context['testsuite']
testsuite: TestSuite = result.context['testsuite']

# Final summary should be printed only to stdout with custom formatting
# If test results are required for parsing, they can be found in the test results files
print(testsuite.get_final_summary())
testsuite.print_final_status(result.logger)
make_reports(context)
make_reports(context, testsuite)
return testsuite


Expand Down
5 changes: 2 additions & 3 deletions kubemarine/procedures/check_paas.py
Original file line number Diff line number Diff line change
Expand Up @@ -1768,14 +1768,13 @@ def main(cli_arguments: List[str] = None) -> TestSuite:
flow_ = flow.ActionsFlow([PaasAction()])
result = flow_.run_flow(context, print_summary=False)

context = result.context
testsuite: TestSuite = context['testsuite']
testsuite: TestSuite = result.context['testsuite']

# Final summary should be printed only to stdout with custom formatting
# If tests results required for parsing, they can be found in test results files
print(testsuite.get_final_summary(show_minimal=False, show_recommended=False))
testsuite.print_final_status(result.logger)
check_iaas.make_reports(context)
check_iaas.make_reports(context, testsuite)
return testsuite


Expand Down
3 changes: 2 additions & 1 deletion kubemarine/procedures/upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,8 @@ def run(self, res: DynamicResources) -> None:
flow.run_tasks(res, self.action_tasks)
finally:
cluster = res.cluster_unsafe()
procedure_context = {} if cluster is None else cluster.procedure_context
procedure_context = ({} if cluster is None or cluster.procedure_context is None
else cluster.procedure_context)
upgrade_version_verified = (kubernetes.verify_version.name
in procedure_context.get('proceeded_functions', []))
if upgrade_version_verified and cluster is not None:
Expand Down

0 comments on commit f32d388

Please sign in to comment.