feat: output return status too

This commit is contained in:
egarette@silique.fr 2025-02-10 09:46:31 +01:00
parent ad707df62d
commit 9c55b5aa25
13 changed files with 177 additions and 6 deletions

View file

@ -1,6 +1,6 @@
""" """
Silique (https://www.silique.fr) Silique (https://www.silique.fr)
Copyright (C) 2024 Copyright (C) 2024-2025
This program is free software: you can redistribute it and/or modify it This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by the under the terms of the GNU Lesser General Public License as published by the
@ -107,10 +107,12 @@ class RougailOutputFormatter:
with BytesIO() as ymlfh: with BytesIO() as ymlfh:
self.yaml.dump(self.families[None], ymlfh) self.yaml.dump(self.families[None], ymlfh)
ret = ymlfh.getvalue().decode("utf-8").strip() + '\n' ret = ymlfh.getvalue().decode("utf-8").strip() + '\n'
return ret return True, ret
def print(self): def print(self):
print(self.run()) ret, data = self.run()
print(data)
return ret
def parse(self): def parse(self):
# FIXME path to relative ! # FIXME path to relative !

View file

@ -1,6 +1,6 @@
""" """
Silique (https://www.silique.fr) Silique (https://www.silique.fr)
Copyright (C) 2024 Copyright (C) 2024-2025
This program is free software: you can redistribute it and/or modify it This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by the under the terms of the GNU Lesser General Public License as published by the

View file

@ -4,7 +4,7 @@ Cadoles (http://www.cadoles.com)
Copyright (C) 2021 Copyright (C) 2021
Silique (https://www.silique.fr) Silique (https://www.silique.fr)
Copyright (C) 2022-2024 Copyright (C) 2022-2025
This program is free software: you can redistribute it and/or modify it This program is free software: you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by the under the terms of the GNU Lesser General Public License as published by the

View file

@ -0,0 +1,11 @@
---
version: 1.1
secret1:
description: the first variable
type: secret
secret2:
description: the second variable
type: secret
default: value

View file

@ -0,0 +1,24 @@
---
version: 1.1
condition: no # a conditional variable
variable1:
description: a first variable
multi: true
disabled:
jinja: |-
{% if _.condition == "yes" %}
condition is yes
{% endif %}
description: if condition is egal to "yes"
variable2:
description: a second variable
multi: true
disabled:
jinja: |-
{% if _.condition == "yes" %}
condition is yes
{% endif %}
description: if condition is egal to "yes"

View file

@ -0,0 +1,10 @@
---
version: 1.1
condition: false # a condition
variable:
description: a variable
multi: true
disabled:
variable: _.condition

View file

@ -0,0 +1,22 @@
---
version: 1.1
leader:
description: a leadership
type: leadership
leader: # a leader
- value1
- value2
follower1: val11 # a follower
follower2: val21 # an other follower
calculate:
description: a calculated variable
multi: true
default:
jinja: |-
{{ _.leader.follower1[0] }}
unique: false

View file

@ -0,0 +1,22 @@
---
version: 1.1
leader:
description: a leadership
type: leadership
leader: # a leader
- value1
- value2
follower1: val11 # a follower
follower2: val21 # an other follower
calculate:
description: a calculated variable
multi: true
default:
jinja: |-
{{ _.leader.follower1[-1] }}
unique: false

View file

@ -0,0 +1,21 @@
---
version: 1.1
leader:
description: a leadership
type: leadership
leader: # a leader
- value1
- value2
follower1: val11 # a follower
follower2: val21 # an other follower
calculate:
description: a calculated variable
multi: true
default:
variable: _.leader.follower1
unique: false

View file

@ -0,0 +1,20 @@
---
version: 1.1
leader:
description: a leadership
type: leadership
leader: # a leader
- value1
- value2
follower1: val11 # a follower
follower2: val21 # an other follower
calculate:
description: a calculated variable
default:
jinja: >-
{{ _.leader.leader[0] }}

View file

@ -0,0 +1,20 @@
---
version: 1.1
leader:
description: a leadership
type: leadership
leader: # a leader
- value1
- value2
follower1: val11 # a follower
follower2: val21 # an other follower
calculate:
description: a calculated variable
default:
jinja: >-
{{ _.leader.leader[-1] }}

View file

@ -0,0 +1,19 @@
---
version: 1.1
leader:
description: a leadership
type: leadership
leader: # a leader
- value1
- value2
follower1: val11 # a follower
follower2: val21 # an other follower
calculate:
description: a calculated variable
default:
variable: _.leader.leader

View file

@ -32,7 +32,7 @@ def _test_structural_files(file_name, namespace, rougailconfig):
rougailconfig['step.output'] = 'formatter' rougailconfig['step.output'] = 'formatter'
################################## ##################################
config = None config = None
generated_output = RougailOutput(config, rougailconfig=rougailconfig).run() generated_output = RougailOutput(config, rougailconfig=rougailconfig).run()[1]
output_file = get_output_director(namespace) / file_name.parent.parent.name / file_name.parent.name / file_name.name output_file = get_output_director(namespace) / file_name.parent.parent.name / file_name.parent.name / file_name.name
if not output_file.is_file(): if not output_file.is_file():
if not output_file.parent.is_dir(): if not output_file.parent.is_dir():