feat: remove json.read_write option
This commit is contained in:
parent
4f393bc884
commit
cba9eeab1b
3 changed files with 6 additions and 15 deletions
|
|
@ -79,17 +79,6 @@ class RougailOutputAnsible(RougailOutputJson):
|
||||||
return super().manage_errors()
|
return super().manage_errors()
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def parse_family(
|
|
||||||
self,
|
|
||||||
conf,
|
|
||||||
child,
|
|
||||||
):
|
|
||||||
if self.read_write and conf.path() == self.host_namespace:
|
|
||||||
self.config.property.read_only()
|
|
||||||
super().parse_family(conf, child)
|
|
||||||
if self.read_write and conf.path() == self.host_namespace:
|
|
||||||
self.config.property.read_write()
|
|
||||||
|
|
||||||
def json_to_ansible(self):
|
def json_to_ansible(self):
|
||||||
ret = {"_meta": {"hostvars": {}}}
|
ret = {"_meta": {"hostvars": {}}}
|
||||||
if "_warnings" in self.dico:
|
if "_warnings" in self.dico:
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,6 @@
|
||||||
version: "1.1"
|
version: "1.1"
|
||||||
|
|
||||||
hostnames:
|
hostnames:
|
||||||
hidden: true
|
|
||||||
|
|
||||||
group1:
|
group1:
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,6 @@ def _test_structural_files(test_dir, namespace, ext, *, read_write=True, mandato
|
||||||
return
|
return
|
||||||
##################################
|
##################################
|
||||||
rougailconfig['step.output'] = 'ansible'
|
rougailconfig['step.output'] = 'ansible'
|
||||||
rougailconfig["json.read_write"] = read_write
|
|
||||||
rougailconfig["json.mandatory"] = mandatory
|
rougailconfig["json.mandatory"] = mandatory
|
||||||
extra_namespaces = rougailconfig["extra_namespaces"]
|
extra_namespaces = rougailconfig["extra_namespaces"]
|
||||||
extra_namespaces["hosts"] = [str(Path(__file__).parent / "hosts")]
|
extra_namespaces["hosts"] = [str(Path(__file__).parent / "hosts")]
|
||||||
|
|
@ -61,10 +60,14 @@ def _test_structural_files(test_dir, namespace, ext, *, read_write=True, mandato
|
||||||
##################################
|
##################################
|
||||||
if do_calc and (mandatory or not read_write):
|
if do_calc and (mandatory or not read_write):
|
||||||
if mandatory:
|
if mandatory:
|
||||||
get_values_for_config(config)
|
get_values_for_config(config, exclude_namespace="hosts")
|
||||||
else:
|
else:
|
||||||
get_values_for_config(config, level="mandatories")
|
get_values_for_config(config, level="mandatories", exclude_namespace="hosts")
|
||||||
##################################
|
##################################
|
||||||
|
if read_write:
|
||||||
|
config.property.read_write()
|
||||||
|
else:
|
||||||
|
config.property.read_only()
|
||||||
generated_output = RougailOutput(config, rougailconfig=rougailconfig).run()[1]
|
generated_output = RougailOutput(config, rougailconfig=rougailconfig).run()[1]
|
||||||
output_file = Path(__file__).parent / 'results' / dir_name / (test_dir.name + "." + ext)
|
output_file = Path(__file__).parent / 'results' / dir_name / (test_dir.name + "." + ext)
|
||||||
if not output_file.is_file():
|
if not output_file.is_file():
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue