Age | Commit message (Collapse) | Author |
|
calling showConfig, else, default to config.boot
|
|
instead of calling cli-shell-api.
|
|
|
|
functions under it.
This is required for programs running outside a CLI session, like the future API daemon.
|
|
Add vyos.config.show_config to show working configuration.
Add vyos.remote.get_config_remote() for obtaining remote config files.
|
|
|
|
|
|
|
|
|
|
|
|
like their Perl counterparts.
Most scripts used to do something like
my $foo = $config->returnValue("system foo");
if !defined($foo) {
$foo = $defaultFooValue;
}
In most cases values do not exist because they are optional and simply not set.
In a substantial minority of cases they don't exist but are mandatory, in this case
it's probably a good practice to check if it exists first.
In rare but frustrating cases returnValue returns undef because the path is wrong.
It was tempting but as it turns out impractical to force the user to handle every undefined
value as an error, but the cost of wrapping every return_value call in a try/except block
is too high.
Instead we should facilitate the most common case. For this, those functions now support
an optional named argument default=None so an optional value with a sensible default can be
handled like
$foo = config.return_value("system foo", default="bar")
|
|
to avoid having to decode it anywhere else.
|
|
|