4 Commits

Author SHA1 Message Date
Gris Ge
733deba324 cli service: Allow user to opt-in on not deleting applied file
Previously, we introduced new method on finding un-applied state YAML
files. It was a changed behaviour which break API.

This patch change `nmstatectl service` to original behaviour which just
rename applied YAML file with `.applied` postfix.

If you don't want the applied state been deleted, please place
`/etc/nmstate/nmstate.conf` (folder can be defined by `--config`
argument) with content of:

```toml
[service]
keep_state_file_after_apply = true
```

Manpage updated.

Integration test case included.

Signed-off-by: Gris Ge <fge@redhat.com>
2024-02-08 15:03:47 +08:00
Enrique Llorente
e5e74a7632 service: Use content instead of checksum
Using checksum for the .applied file breaks backward compatibility and
introduce at new crypto library with possible CVEs.

This changes replace that by copying the content instead of calculating
the checksum.

Signed-off-by: Enrique Llorente <ellorent@redhat.com>
2024-02-08 11:29:33 +08:00
Enrique Llorente
dbb98e1d30 service: Mark .applied with checksum
At some envs like openshift machine-config-operator moving configuration
files can break in place upgrades. This chane use checksums storead at
the .applied files to check for changes.

Signed-off-by: Enrique Llorente <ellorent@redhat.com>
2023-12-19 16:01:17 +01:00
Gris Ge
5fa085ae6f cli: Add service subcommand
With command `sudo nmstatectl service -c <config_folder>`, nmstatectl
will search all `.yml` files in specified folder(default to
`/etc/nmstate`), and apply those state files. Any applied state file
will be then renamed to `.applied` suffix.

The config files are sorted by rust native lexicographical order.

Man page for `nmstatectl` updated.
Add new man page `nmstate.service(8)`.
Systemd unit file included.
RPM spec file updated.
Integration test case included.

Signed-off-by: Gris Ge <fge@redhat.com>
2022-06-27 13:44:52 +08:00