feat(config-revisions): declare a device's own configuration history
driver / lint (pull_request) Successful in 13s
driver / standard (pull_request) Successful in 16s
driver / types (pull_request) Successful in 1m3s
driver / test (3.13) (pull_request) Successful in 1m12s
driver / test (3.12) (pull_request) Successful in 1m18s
driver / lowest (pull_request) Successful in 47s
driver / build (pull_request) Successful in 34s
driver / security (pull_request) Successful in 3m34s
CI / driver (pull_request) Successful in 5m2s
driver / publish (pull_request) Skipped
driver / lint (pull_request) Successful in 13s
driver / standard (pull_request) Successful in 16s
driver / types (pull_request) Successful in 1m3s
driver / test (3.13) (pull_request) Successful in 1m12s
driver / test (3.12) (pull_request) Successful in 1m18s
driver / lowest (pull_request) Successful in 47s
driver / build (pull_request) Successful in 34s
driver / security (pull_request) Successful in 3m34s
CI / driver (pull_request) Successful in 5m2s
driver / publish (pull_request) Skipped
Some devices keep a copy of their configuration for every save and can go back to one. An application restores a configuration there by reverting to the revision that holds it; on OPNsense that is the only way, since its API takes no uploaded config.xml (NetOrk/netork#2511). ConfigRevisionsMixin declares get_config_revisions() (newest first, as ConfigRevisionDict) and get_config_revision(revision_id). revert_config_revision(revision_id) is a template over the driver's _revert_to_config_revision step: it refuses an id that is not in the history (UnknownConfigRevision), reads the revision before the revert can rotate it out, and afterwards checks that the newest revision holds its configuration (ConfigRevertFailed otherwise), since a device may report a revert it did not make. config_revision_content(text) is the hook where a driver leaves out what its device stamps into every save, so revisions with the same configuration compare equal. Refs NetOrk/netork#2511
This commit is contained in:
1 parent
241acef6c1
commit
43e0210ff6
5 files changed
+349
No files matched your search
@@ -374,6 +374,23 @@ that 4.35.0 commented out comes back on the next write -- and systemd-timesyncd'
|
||||
`LinkNTPServers` stay. ntpd and OpenNTPD are read, not written; what DHCP gives them is
|
||||
unknown.
|
||||
|
||||
`ConfigRevisionsMixin` (`get_config_revisions`, `get_config_revision`,
|
||||
`revert_config_revision`) is a device's own configuration history: a copy of the
|
||||
configuration for every save, which the device can go back to. An application restores a
|
||||
configuration there by reverting to the revision that holds it -- on OPNsense the only way,
|
||||
since its API takes no uploaded config.xml (NetOrk/netork#2511). Listing (newest first, the
|
||||
first in place now: id, UTC time, description, user, size as `ConfigRevisionDict`) and
|
||||
reading one revision are declared only. `revert_config_revision(revision_id)` is a
|
||||
template: it refuses an id that is not in the history (`UnknownConfigRevision`, a
|
||||
`ValueError`) before anything changes, reads the revision -- before the revert, which may
|
||||
rotate it out -- lets the driver revert (`_revert_to_config_revision`), and checks that the
|
||||
newest revision afterwards holds the revision's configuration (`ConfigRevertFailed`
|
||||
otherwise: a device may say it reverted when it did not). It returns that newest revision.
|
||||
`config_revision_content(text)` is what of a revision is its configuration; a driver whose
|
||||
device stamps every save (who, when) strips the stamp there, and an application that looks
|
||||
for the revision holding a configuration compares through it too. A driver that can list
|
||||
but not revert sets `revert_config_revision = None`.
|
||||
|
||||
### Access channels: why there is no container model here
|
||||
|
||||
`CommandChannelMixin` declares a driver's public channel to its host:
|
||||
|
||||
Reference in new issue
Block a user