Bases: endian.datatypes.config_list.ConfigList, endian.data.interfaces.ContainerInterface, endian.data.interfaces.ExpireableFile
Bases: exceptions.Exception
Bases: exceptions.Exception
Bases: endian.data.container.abstractconfig.AbstractConfigFile, object
Bases: endian.data.container.abstractconfig.ConfigFileParseError
Bases: exceptions.Exception
Bases: endian.datatypes.config_dict.ConfigDict, endian.data.interfaces.ContainerInterface, endian.data.interfaces.ExpireablePaths
Bases: exceptions.Exception
Bases: UserList.UserList, endian.data.interfaces.ContainerInterface, endian.data.container.defaultresolver.DefaultResolver, endian.data.interfaces.ExpireableFile
Small interface to efw plain files,
If the file does not exist, PlainFile loads from a number of default files:
<STATE_D>/<path> <USER_D>/<path> <PROVISIONING_D>/<path> (**) <PERSISTENT_D>/dirname(<path>)/default/basename(<path>). (**) <PERSISTENT_D>/dirname(<path>)/default/basename(<path>) (**) <STATE_D>/dirname(<path>)/default/basename(<path>) (**) <USER_D>/dirname(<path>)/default/basename(<path>) (**)
(**) each path will be searched back the directory hierarchy for a default/vendor - directory which contains the searched file. Those files will be read out also and with precedence of it’s hierarchy level.
for example:
PlainFile('ethernet/br0')
reads:
/var/lib/ethernet/settings
/var/efw/ethernet/settings
/var/emc/ethernet/settings
/usr/lib/efw/ethernet/default/settings.
/usr/lib/efw/ethernet/default/settings
/var/efw/ethernet/default/settings
/var/lib/efw/ethernet/default/settings
Meaning of directories:
PERSISTENT_D
should contain only packaged files which will be changed only
when upgrading (default: /usr/lib/efw)
STATE_D
should contain only files which the system creates. This way the
system can override default values and/or the actual
configuration (default: /var/lib/efw)
USER_D
should contain only files the user created/modified (default:
/var/efw)
PROVISIONING_D
where the provisioning settings files are stored (default:
/var/emc)
default:
contain files with default values packaged by the original
package. vendor or product related default files can be done by
creating files like settings.mybrand
Bases: endian.data.container.abstractconfig.AbstractConfigFile, object
Bases: endian.data.container.abstractconfig.ConfigFileParseError
Bases: exceptions.Exception
Bases: endian.datatypes.config_dict.ConfigDict, endian.data.interfaces.ContainerInterface, endian.data.container.defaultresolver.DefaultResolver, endian.data.interfaces.ExpireableFile, object
Small interface to the efw settings files, which allows to load all key/value pairs from a file specified by a path. SettingsFile behaves like a dict, which allows to give access to the key/value pairs in an easy manner.
Each key is case in-sensitive and is accessible also through __getattr__.
>>> ds = SettingsFile('ethernet/settings')
>>> ds['GREEN_IPS']
... '10.1.1.1/24'
>>> ds['green_ips']
'10.1.1.1/24'
>>> ds['green_ips']
'10.1.1.1/24'
>>> ds['GREEN_ips']
'10.1.1.1/24'
>>> ds.GREEN_ips
'10.1.1.1/24'
>>> ds.GREEN_IPS
'10.1.1.1/24'
>>> ds.green_ips
'10.1.1.1/24'
SettingsFile pre-loads the dict with default values from a number of files:
<PERSISTENT_D>/dirname(<path>)/default/basename(<path>) (**)
<PERSISTENT_D>/dirname(<path>)/default/basename(<path>).* (**)
<USER_D>/dirname(<path>)/default/basename(<path>) (**)
<PERSISTENT_D>/dirname(<path>)/vendor/basename(<path>) (**) (deprecated by glob)
<USER_D>/dirname(<path>)/vendor/basename(<path>) (**) (deprecated by glob)
<STATE_D>/dirname(<path>)/default/basename(<path>) (**)
<USER_D>/<path>
<STATE_D>/<path>
<STATE_D>/<path>.*
(**) each path will be searched back the directory hierarchy for a default/vendor - directory which contains the searched file. Those files will be read out also and with precedence of it’s hierarchy level.
for example:
SettingsFile('openvpnclients/client1/settings')
reads:
/usr/lib/efw/openvpnclients/default/settings
/usr/lib/efw/openvpnclients/default/client1/settings
/usr/lib/efw/openvpnclients/default/settings.*
/usr/lib/efw/openvpnclients/default/client1/settings.*
/var/efw/openvpnclients/default/settings
/var/efw/openvpnclients/default/client1/settings
/usr/lib/efw/openvpnclients/vendor/settings
/usr/lib/efw/openvpnclients/vendir/client1/settings
/var/efw/efw/openvpnclients/vendor/settings
/var/efw/efw/openvpnclients/vendir/client1/settings
/var/lib/efw/openvpnclients/default/settings
/var/lib/efw/openvpnclients/default/client1/settings
/var/efw/openvpnclients/client1/settings
/var/lib/openvpnclients/client1/settings
/var/lib/openvpnclients/client1/settings.*
Meaning of directories:
The readout of default and vendor files in /var/efw is for backwards compatibility only.
Modifiying values within the dict using __setitem__ allows to alter values. If they will be written down using save() causes to write down only the difference to the default/vendor values.
Returns the configuration in raw mode as a diff to the default settings
Returns the configuration in raw mode
Reads out the setting, default and vendor values if they exist. No error will be thrown if no settings exist.
Returns the configuration settings dictionary.
@deprecated settings Only for backwards compatibily
writes down the new configuration file as a diff to the default settings.
Bases: endian.data.container.abstractconfig.AbstractConfigFile, object
Bases: endian.data.container.abstractconfig.ConfigFileParseError