Commit Graph

31 Commits

Author SHA1 Message Date
Dietmar Maurer
0ffe40fcfa bump proxmox-section-config to 2.0.2-1
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2024-05-17 11:04:10 +02:00
Dietmar Maurer
a2693c7046 section-config: pass filesystem paths as AsRef<Path>
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2024-05-17 10:59:20 +02:00
Wolfgang Bumiller
b5b563e215 bump proxmox-section-config to 2.0.1-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-02-02 14:03:51 +01:00
Wolfgang Bumiller
7ea502b351 bump proxmox-section-config to 2.0.0-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-07-24 11:03:15 +02:00
Lukas Wagner
8013a80b41 section-config: derive Clone for SectionConfigData
Signed-off-by: Lukas Wagner <l.wagner@proxmox.com>
2023-07-24 10:25:20 +02:00
Wolfgang Bumiller
8f8d52f148 update d/copyright files to debian copyright-format 1.0
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2023-05-23 13:02:39 +02:00
Fabian Grünbichler
6eb638c806 section-config: silence clippy
these two functions don't actually use the `type_name` parameter, but the
interface including custom formatters require it.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2022-12-13 14:53:28 +01:00
Fabian Grünbichler
77ac0bd5fe section-config: make ReST dump reproducible
HashMaps are not ordered, so each package build containing a section config
dump would have the documentation ordered randomly.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2022-12-13 14:51:50 +01:00
Fiona Ebner
cb2646c7b4 section config: fix handling array schema in unknown sections
Mostly relevant when the config is written out again after parsing it
with unknown sections. Previously, with duplicate keys, only the last
value would be saved. Now, duplicate keys are assumed to be part of
an array schema and handled as such.

Because the unknown section parsing does not know if a certain
property does actually have an array schema, it's not possible to
detect duplicate keys for non-array-schema properties, and if a
property with array-schema shows up only once, it will not be saved as
a Value::Array, but a Value::String.

Writing, or to be precise the format_section_content methods, already
handle Value::Array, so don't need to be adapted.

Fixes: 0cd0d16 ("section config: support allowing unknown section types")
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2022-12-12 14:03:26 +01:00
Fiona Ebner
e97f41e290 section config: add test for array schema
where duplicate keys are allowed.

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2022-12-12 14:03:23 +01:00
Fabian Grünbichler
46a675830d update d/control files
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2022-12-07 09:48:47 +01:00
Fabian Grünbichler
bdca6de588 update d/control files
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2022-12-07 09:48:47 +01:00
Fabian Grünbichler
e5abc0590e define workspace dependencies in workspace
so that we no longer have to (or forget to) bump the version in multiple places.

notable changes:
- outdated versions have been unified
- proxmox-metrics -> proxmox-async no longer uses explicit empty features
  (proxmox-async doesn't provide any anyway)
- proxmox-subscription -> proxmox-http no longer uses explicit default_features
  = false (proxmox-http has an empty default feature anyway)
- missing path dependencies added (mainly proxmox-rest-server)

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2022-12-07 09:48:38 +01:00
Fabian Grünbichler
4189221470 inherit shared, external dependencies
noteworthy changes:
- proxmox-http had a default_features_false dep on hyper, which is dropped (the
  default feature is empty anyway)
- hyper, libc, nix, tokio and url versions are unified
- missing (cosmetic) bindgen feature on zstd enabled everywhere

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2022-12-07 09:48:38 +01:00
Fabian Grünbichler
64959d9ae0 move common metadata to workspace
and switch all crates to 2021 edition as well as a unified "authors" value.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2022-12-07 09:48:25 +01:00
Fabian Grünbichler
5ec765f842 update d/control files
debcargo 2.6 changed some minor details

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2022-12-06 11:21:43 +01:00
Fabian Grünbichler
538578c558 clippy 1.65 fixes
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2022-12-05 11:17:37 +01:00
Wolfgang Bumiller
d513ef7836 bump proxmox-section-config to 1.0.2-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-11-28 09:30:03 +01:00
Wolfgang Bumiller
c39d04c33e minor doc fixup
an 'ignore' block assumes rust syntax, a 'text' block should
just be plain text

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-11-28 09:27:28 +01:00
Fiona Ebner
0cd0d16c1e section config: support allowing unknown section types
Similar to commit c9ede1c ("support unknown types in section config")
in pve-common.

Unknown sections are parsed as String-JSON String key-value pairs
without any additional checks and also written as-is.

Suggested-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2022-11-28 09:19:05 +01:00
Wolfgang Bumiller
208d4ffac6 bump proxmox-section-config to 1.0.1-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-10-24 14:07:30 +02:00
Wolfgang Bumiller
c8f26ee0ea section-config: expose order
we already expose the raw sections which are sometimes
easier to use, but we don't expose the order at all this way
otherwise

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-10-24 13:45:58 +02:00
Wolfgang Bumiller
b4a798f0a7 section-config: use Vec for section order
We use none of the additional functionality provided by
VecDeque.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-10-24 13:44:23 +02:00
Fiona Ebner
3b2b1214b3 section config: parse additional properties when schema allows it
Additional properties will be parsed according to the default string
schema.

This is relevant for use cases when the full schema is not known for
some reason or another. In particular this allows support for parsing
older/newer versions of configuration files. One example of this is
the proposed proxmox-mail-forward helper binary, which currently
doesn't have access to the PBS API types for dependency reasons and
is only interested in the email field for the root user. If it can
only use a minimal schema with additional_properties set to true, it
will be robust against changes.

Writing already works, because the ObjectSchema's verify_json()
already handles additional_properties correctly and
format_section_content() handles them like all other properties
(method doesn't depend on the schema).

Signed-off-by: Fiona Ebner <f.ebner@proxmox.com>
2022-10-24 13:35:50 +02:00
Wolfgang Bumiller
064791e565 section-config: clippy fixes
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-06-29 10:11:28 +02:00
Thomas Lamprecht
9c0e9dca59 tree wide update of genereated control
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2022-05-05 10:22:50 +02:00
Wolfgang Bumiller
57d052af36 workspace: set proxmox-lang dep version to 1.1
to ensure the error macros are available

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2022-02-21 13:45:46 +01:00
Fabian Grünbichler
d363fb2bee switch to new schema verify methods
the deprecated ones only forward to the new ones anyway..

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2021-12-30 11:51:08 +01:00
Fabian Grünbichler
9c9b5c02b4 clippy: collapse match/if let/..
best viewed with `-w` ;)

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2021-12-02 09:01:52 +01:00
Fabian Grünbichler
a81b2672d8 clippy: remove unnecessary reference taking
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2021-12-02 08:58:10 +01:00
Wolfgang Bumiller
f35dbbd651 add proxmox-section-config crate
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-10-11 11:39:59 +02:00