feat: remove json.read_write option
This commit is contained in:
parent
39de31c459
commit
9d478ab76a
3 changed files with 17 additions and 17 deletions
|
|
@ -57,7 +57,6 @@ class RougailOutputJson:
|
|||
self.warnings = user_data_warnings
|
||||
else:
|
||||
self.warnings = []
|
||||
self.read_write = self.rougailconfig["json.read_write"]
|
||||
self.is_mandatory = self.rougailconfig["json.mandatory"]
|
||||
self.get = self.rougailconfig["json.get"]
|
||||
self.dico = {}
|
||||
|
|
@ -76,14 +75,14 @@ class RougailOutputJson:
|
|||
return ret
|
||||
|
||||
def exporter(self) -> None:
|
||||
self.config.property.read_write()
|
||||
self.mandatory()
|
||||
self.config.property.read_only()
|
||||
if self.is_mandatory:
|
||||
ori_properties = self.config.property.exportation()
|
||||
self.config.property.read_write()
|
||||
self.mandatory()
|
||||
self.config.property.importation(ori_properties)
|
||||
if self.manage_errors():
|
||||
return False
|
||||
self.manage_warnings()
|
||||
if self.read_write:
|
||||
self.config.property.read_write()
|
||||
if self.get:
|
||||
config = self.config.option(self.get)
|
||||
if not config.isoptiondescription():
|
||||
|
|
@ -98,8 +97,6 @@ class RougailOutputJson:
|
|||
return True
|
||||
|
||||
def mandatory(self):
|
||||
if not self.is_mandatory:
|
||||
return
|
||||
title = False
|
||||
options_with_error = []
|
||||
try:
|
||||
|
|
@ -114,7 +111,6 @@ class RougailOutputJson:
|
|||
try:
|
||||
option.value.get()
|
||||
if not title:
|
||||
# self.errors.append("Les variables suivantes sont obligatoires mais n'ont pas de valeur :")
|
||||
self.errors.append(
|
||||
_("The following variables are mandatory but have no value:")
|
||||
)
|
||||
|
|
@ -125,7 +121,6 @@ class RougailOutputJson:
|
|||
if not title:
|
||||
for idx, option in enumerate(options_with_error):
|
||||
if not idx:
|
||||
# self.errors.append("Les variables suivantes sont inaccessibles mais sont vides et obligatoires :")
|
||||
self.errors.append(
|
||||
_(
|
||||
"The following variables are inaccessible but are empty and mandatory :"
|
||||
|
|
|
|||
|
|
@ -28,19 +28,21 @@ def get_rougail_config(
|
|||
json:
|
||||
description: {_('configuration rougail-json')}
|
||||
disabled:
|
||||
type: jinja
|
||||
jinja: |
|
||||
{{% if step.output is propertyerror or step.output != 'json' %}}
|
||||
disabled
|
||||
{{% endif %}}
|
||||
|
||||
read_write:
|
||||
description: {_('display variables available in read_write mode')}
|
||||
default: false
|
||||
|
||||
mandatory:
|
||||
description: {_('test mandatories variables before display in json')}
|
||||
default: true
|
||||
type: boolean
|
||||
default:
|
||||
jinja: |-
|
||||
{{% if cli.read_write is defined and cli.read_write %}}
|
||||
false
|
||||
{{% else %}}
|
||||
true
|
||||
{{% endif %}}
|
||||
|
||||
get:
|
||||
description: {_('get value for a variable or a family')}
|
||||
|
|
|
|||
|
|
@ -34,7 +34,6 @@ def _test_structural_files(test_dir, namespace, ext, *, read_write=True, mandato
|
|||
return
|
||||
##################################
|
||||
rougailconfig['step.output'] = 'json'
|
||||
rougailconfig["json.read_write"] = read_write
|
||||
rougailconfig["json.mandatory"] = mandatory
|
||||
##################################
|
||||
dir_name = 'test'
|
||||
|
|
@ -56,6 +55,10 @@ def _test_structural_files(test_dir, namespace, ext, *, read_write=True, mandato
|
|||
if do_calc and (mandatory or not read_write):
|
||||
get_values_for_config(config)
|
||||
##################################
|
||||
if read_write:
|
||||
config.property.read_write()
|
||||
else:
|
||||
config.property.read_only()
|
||||
generated_output = RougailOutput(config, rougailconfig=rougailconfig).run()[1]
|
||||
output_file = Path(__file__).parent / 'results' / dir_name / (test_dir.name + "." + ext)
|
||||
if not output_file.is_file():
|
||||
|
|
|
|||
Loading…
Reference in a new issue