Skip to content

Commit

Permalink
Passed FileNotFoundError exceptions and correct stringify_value function
Browse files Browse the repository at this point in the history
  • Loading branch information
philippemerle committed Jul 29, 2024
1 parent cab074a commit f32023e
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions bin/cloudnet/tosca/alloy.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#
# Software Name : Cloudnet TOSCA toolbox
# Version: 1.0
# SPDX-FileCopyrightText: Copyright (c) 2020-22 Orange
# SPDX-FileCopyrightText: Copyright (c) 2020-24 Orange
# SPDX-License-Identifier: Apache-2.0
#
# This software is distributed under the Apache License 2.0
Expand Down Expand Up @@ -646,7 +646,7 @@ def stringify_value(
context_error_message + ": " + str(value) + " - boolean expected",
value,
)
return False
return "False"
return str(value).lower()

elif value_type == "integer":
Expand Down Expand Up @@ -707,7 +707,7 @@ def stringify_value(
+ " expected",
value,
)
return value
return str(value)
scalar_value, scalar_unit = self.split_scalar_unit(
value, context_error_message
)
Expand Down Expand Up @@ -4163,9 +4163,12 @@ def generation(self):
# if import_file.endswith('.yml') or import_file.endswith('.yaml'):
# import_file = import_file[:import_file.rfind('.')] # remove YAML extension.
# open_file = utils.normalize_name(import_file)
imported_template = self.tosca_service_template.imports(import_file)
open_file = self.compute_filename(imported_template)
self.generate(Alloy.OPEN, open_file)
try:
imported_template = self.tosca_service_template.imports(import_file)
open_file = self.compute_filename(imported_template)
self.generate(Alloy.OPEN, open_file)
except FileNotFoundError:
pass
self.generate()

#
Expand Down

0 comments on commit f32023e

Please sign in to comment.