From fe2b6fb6a20c57ab5fcd739680cc07d6520e9c58 Mon Sep 17 00:00:00 2001 From: Emmanuel Garette Date: Tue, 16 May 2023 22:11:55 +0200 Subject: [PATCH] fix(api) test option is an optiondescription with a symlink --- tests/test_symlink.py | 1 + tiramisu/api.py | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/test_symlink.py b/tests/test_symlink.py index 5937ece..b9ff097 100644 --- a/tests/test_symlink.py +++ b/tests/test_symlink.py @@ -317,6 +317,7 @@ def test_symlink_with_follower(config_type): od1 = OptionDescription('root', '', [interface1, follower]) cfg = Config(od1) cfg = get_config(cfg, config_type) + assert not cfg.option('follower').option.isoptiondescription() assert cfg.value.dict() == {'ip_admin_eth0.ip_admin_eth0': [], 'follower': []} cfg.option('ip_admin_eth0.ip_admin_eth0').value.set(['val1', 'val2']) assert cfg.value.dict() == {'ip_admin_eth0.ip_admin_eth0': [{'ip_admin_eth0.ip_admin_eth0': 'val1', 'ip_admin_eth0.netmask_admin_eth0': None}, {'ip_admin_eth0.ip_admin_eth0': 'val2', 'ip_admin_eth0.netmask_admin_eth0': None}], 'follower': [None, None]} diff --git a/tiramisu/api.py b/tiramisu/api.py index 730692c..091c839 100644 --- a/tiramisu/api.py +++ b/tiramisu/api.py @@ -271,7 +271,7 @@ class _TiramisuOptionOptionDescription(CommonTiramisuOption): )) return options - @option_type(['optiondescription', 'option', 'with_or_without_index']) + @option_type(['optiondescription', 'option', 'with_or_without_index', 'symlink']) def isoptiondescription(self, options_bag: List[OptionBag]): """Test if option is an optiondescription""" option_bag = options_bag[-1] @@ -1415,7 +1415,8 @@ class TiramisuAPI(TiramisuHelp): if subfunc == 'option': config_bag = self._config_bag return TiramisuDispatcherOption(config_bag, - self._orig_config_bags) + self._orig_config_bags, + ) if subfunc in ['forcepermissive', 'unrestraint', 'nowarnings']: if self._orig_config_bags: msg = _('do not use unrestraint, nowarnings or forcepermissive together')