diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-04-11 15:33:01 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-11 15:33:01 +0200 |
commit | c27f13ab459ef5116eeac417d256abfabf2690c2 (patch) | |
tree | 7b58f7a9fc88bfa24efde7a2196b923f78c96586 /src/conf_mode/interfaces-tunnel.py | |
parent | 74f498f8119a53c801b5e8d37186742b8b303734 (diff) | |
parent | e12a0ce922b67354ecd8e53414cda6b8b3a424fb (diff) | |
download | vyos-1x-c27f13ab459ef5116eeac417d256abfabf2690c2.tar.gz vyos-1x-c27f13ab459ef5116eeac417d256abfabf2690c2.zip |
Merge pull request #326 from thomas-mangin/T2265
dhcp: T2265: refactor DHCP class
Diffstat (limited to 'src/conf_mode/interfaces-tunnel.py')
-rwxr-xr-x | src/conf_mode/interfaces-tunnel.py | 36 |
1 files changed, 1 insertions, 35 deletions
diff --git a/src/conf_mode/interfaces-tunnel.py b/src/conf_mode/interfaces-tunnel.py index 28b1cf60f..19538da72 100755 --- a/src/conf_mode/interfaces-tunnel.py +++ b/src/conf_mode/interfaces-tunnel.py @@ -26,41 +26,7 @@ from vyos.ifconfig.afi import IP4, IP6 from vyos.configdict import list_diff from vyos.validate import is_ipv4, is_ipv6 from vyos import ConfigError - - -class FixedDict(dict): - """ - FixedDict: A dictionnary not allowing new keys to be created after initialisation. - - >>> f = FixedDict(**{'count':1}) - >>> f['count'] = 2 - >>> f['king'] = 3 - File "...", line ..., in __setitem__ - raise ConfigError(f'Option "{k}" has no defined default') - """ - def __init__ (self, **options): - self._allowed = options.keys() - super().__init__(**options) - - def __setitem__ (self, k, v): - """ - __setitem__ is a builtin which is called by python when setting dict values: - >>> d = dict() - >>> d['key'] = 'value' - >>> d - {'key': 'value'} - - is syntaxic sugar for - - >>> d = dict() - >>> d.__setitem__('key','value') - >>> d - {'key': 'value'} - """ - if k not in self._allowed: - raise ConfigError(f'Option "{k}" has no defined default') - super().__setitem__(k, v) - +from vyos.dicts import FixedDict class ConfigurationState(Config): """ |