Commit Graph

2405 Commits

Author SHA1 Message Date
Wolfgang Bumiller
0f2caafc4e bump proxmox to 0.13.0-1 and proxmox-api-macro to 0.5.0
and proxmox-http to 0.4.0... urgh

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-08-25 09:41:17 +02:00
Wolfgang Bumiller
2df0b8efb3 tools::serde: support Option<String> in string_as_base64
This will make Updater derivations go more smoothly.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-08-25 09:41:17 +02:00
Wolfgang Bumiller
f9c6f7a18c bump versionto 0.7.0-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-08-24 15:41:08 +02:00
Wolfgang Bumiller
8c125364e4 websocket: fix doc test
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-08-24 15:19:47 +02:00
Wolfgang Bumiller
917ce00dd6 rustfmt
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-08-13 13:31:57 +02:00
Wolfgang Bumiller
744d69c2ab more updater cleanups
* Updatable is now named UpdaterType
* UPDATER_IS_OPTION is now assumed to always be true
    While an updater can be a non-optional struct, being an
    updater, all its fields are also Updaters, so after
    expanding all levels of nesting, the resulting list of
    fields can only contain optional values.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-08-13 11:11:27 +02:00
Wolfgang Bumiller
cb9d57b453 put API_SCHEMA variable into ApiType trait
This way we can assign `API_SCHEMA` constants to `Option`
types.

Here's why:

The api-macro generated code usese `T::API_SCHEMA` when
building ObjectSchemas.

For Updaters we replace `T` with
  `<T as Updatable>::Updater`

This means for "simple" wrappers like our `Authid` or
`Userid`, the ObjectSchema will try to refer to
  `<Authid as Updatable>::Updater::API_SCHEMA`
which resolves to:
  `Option<Authid>::API_SCHEMA`
which does not exist, for which we cannot add a normal
`impl` block to add the schema variable, since `Option` is
not "ours".

But we now have a blanket implementation of `ApiType` for
`Option<T> where T: ApiType` which just points to the
original `T::API_SCHEMA`.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-08-12 10:15:13 +02:00
Wolfgang Bumiller
783cbcb499 fixup schema entry for updaters with explicit types
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-08-10 14:17:20 +02:00
Wolfgang Bumiller
34020ea3d6 change updater derivation
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-08-10 12:03:29 +02:00
Wolfgang Bumiller
017b81712e api macro: assume that field types are api types by default
#[api]
    struct Foo {
        field: Bar,
    }

does not require the use of
    #[api(
        properties: {
            field: {
                type: Bar,
            },
        },
    )]

anymore

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-08-10 11:42:24 +02:00
Wolfgang Bumiller
8ebcd68a2c refactor serde parsing for later reuse
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-08-10 11:42:24 +02:00
Thomas Lamprecht
4174305528 bump version to 0.6.0-1
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-07-29 18:11:24 +02:00
Fabian Ebner
fb51dcf9db add type DebianCodename
which allows to get rid of an possible error with check_suites, and
easily detect unexpected values with get_current_release_codename.

The check_repos function needs to be adapted, since the type does
not include suite names like oldstable,experimental,etc.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2021-07-29 18:00:38 +02:00
Fabian Ebner
51c69d76a5 repo: remove has_suite_variant helper
by exchanging loops in the check_suites function, which was the only
user. Exchanging loops also helps for introducing a type for Debian condenames.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2021-07-29 18:00:38 +02:00
Fabian Ebner
13cdf8d1df check repos: have caller specify the current suite
Like that, a potential error is further up the stack, and it's more
consistent with what the standard_repository functions do.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2021-07-29 18:00:38 +02:00
Fabian Ebner
c7f6163e2b repo: make suite_variant helper more general
use the first appearance of '-' or '/' to detect the variant instead
of keeping a list of possible variants, which would need to include
things like "-proposed-updates-debug".

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2021-07-29 18:00:38 +02:00
Fabian Ebner
f48c12b00a standard repos: add suite parameter for stricter detection
Require that the suite matches too when detecting standard
repositories, since no or invalid updates will be obtained when the
suite is wrong. Thus, it should not be considered to be the same
repository.

Add the parameter for get_standard_repository too, so that the two
related calls have more similar parameters, and the detection of the
current release code name can be done once in the caller once.

This also will fix an issue with the front-end, where adding a
standard repository would end up just enabling an already present
repository with the wrong suite.

Reported-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2021-07-29 18:00:38 +02:00
Thomas Lamprecht
cb04553d47 proxmox: d/control: commit version update changes
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-07-22 09:53:38 +02:00
Thomas Lamprecht
907a9f344d proxmox: bump version to 0.12.1-1
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-07-22 09:48:04 +02:00
Thomas Lamprecht
3fd900d2b2 tools fs: rust fmt
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-07-22 09:44:17 +02:00
Wolfgang Bumiller
11dccc40b5 fs: link fallback for atomic create
Some file systems don't support renameat2's RENAME_NOREPLACE
flag (eg. ZFS), at the some time, some other file systems
don't support hardlinks via link (eg. vfat, cifs), so we now
try both: first the rename (since it's more efficient), then
link+unlink for the rest.

If both fail, the file system is simply not supported for
our purposes anyway...

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-07-22 09:41:04 +02:00
Dietmar Maurer
a3de24506a depend on proxmox 0.12.0, bump version to 0.6.1
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-07-20 18:10:48 +02:00
Thomas Lamprecht
68064f65bc buildsys: indent continued command
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-07-20 18:08:49 +02:00
Thomas Lamprecht
606eac1db7 cargo: disable default-features for proxmox
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-07-20 17:54:03 +02:00
Thomas Lamprecht
2d9a018854 proxmox: bump api-macro dependency
cyclic stuff is annoying...

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-07-20 17:45:58 +02:00
Thomas Lamprecht
c75e706006 proxmox-api-macro: bump version to 0.4.0
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-07-20 17:45:29 +02:00
Thomas Lamprecht
44d571a8e0 proxmox-http: bump version to 0.3.0
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-07-20 17:45:29 +02:00
Dietmar Maurer
39f12a8c05 depend on proxmox 0.12.0, bump version to 0.5.1-1
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-07-20 17:25:09 +02:00
Dietmar Maurer
5cbddad172 update versions in generated control files 2021-07-20 15:45:45 +02:00
Dietmar Maurer
82d7a1cdbf bump proxmox version to 0.12.0-1 2021-07-20 15:45:45 +02:00
Dietmar Maurer
08c2fc4acb open_file_locked: add options parameter (CreateOptions)
To be able to set file permissions and ownership.

This is a breaking change.
2021-07-20 15:45:45 +02:00
Dietmar Maurer
a818e74a23 new helper atomic_open_or_create_file() 2021-07-20 15:45:45 +02:00
Wolfgang Bumiller
716101d660 move channel/stream helpers to pbs-tools
pbs_tools
  ::blocking: std/async wrapping with block_in_place
  ::stream: stream <-> AsyncRead/AsyncWrite wrapping

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-07-20 11:27:40 +02:00
Thomas Lamprecht
893cc0455d buildsys: drop buster from upload target
we are not really compatible with pbs1, needs a stable-1 branch if we
need to backport something

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-07-20 08:59:59 +02:00
Wolfgang Bumiller
e8349f3d2e move client to pbs-client subcrate
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-07-19 12:58:43 +02:00
Thomas Lamprecht
7d88081e0d bump version to 0.5.0-1
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-07-16 16:19:28 +02:00
Fabian Ebner
5581858b30 code cleanup: use contains()
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2021-07-16 15:22:51 +02:00
Fabian Ebner
2a1fb9bfdd standard repo detection: handle alternative URI for PVE repos
For PVE, URIs without the final "/pve" are also valid.

Make the single URL response a vector and iterate over it, lower
index is preferred.

Reported in the community forum:
https://forum.proxmox.com/threads/pve-7-0-9-no-proxmox-ve-repository-enabled.92427/

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
[ Thomas: extend commit message slightly ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-07-16 15:21:21 +02:00
Fabian Ebner
652f52a1f2 bump proxmox dependency
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2021-07-16 15:18:45 +02:00
Dietmar Maurer
69456e211f bump proxmox version to 0.11.6-1 2021-07-14 12:36:44 +02:00
Dietmar Maurer
26c06df420 make_tmp_file: return File instead of Fd 2021-07-14 12:26:24 +02:00
Thomas Lamprecht
1c81fc4cc1 rest: log response: avoid unnecessary mut on variable
a match expresses the fallback slightly nicer and needs no mut,
which is always nice to avoid.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-07-11 13:05:19 +02:00
Wolfgang Bumiller
223db419a4 test fixups
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-07-07 12:17:10 +02:00
Wolfgang Bumiller
6759d3ebaf split out pbs-buildcfg module
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-07-06 12:00:14 +02:00
Thomas Lamprecht
7bed6d5c31 REST: set error message extenesion for bad-request response log
We send it already to the user via the response body, but the
log_response does not has, nor wants to have FWIW, access to the
async body stream, so pass it through the ErrorMessageExtension
mechanism like we do else where.

Note that this is not only useful for PBS API proxy/daemon but also
the REST server of the file-restore daemon running inside the restore
VM, and it really is *very* helpful to debug things there..

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-07-03 21:34:03 +02:00
Thomas Lamprecht
3c2492f0ff REST: rust fmt
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-07-03 21:34:03 +02:00
Fabian Ebner
9a51a30f46 tests: parse and write the result again
A cheap way to "double" the number of test cases.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2021-07-02 13:04:00 +02:00
Thomas Lamprecht
4b0935c621 bump version to 0.4.0-1
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2021-07-01 18:35:09 +02:00
Fabian Ebner
ae7e2360b7 support quote-word parsing for one-line format
so that parsing CD ROM repositories with spaces in the name works too.
But it's not limited to that, and should make one-line parsing rather
similar to what APT does (stanza parsing in APT doesn't use
ParseQuoteWord at all AFAICS).

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2021-07-01 18:27:27 +02:00
Fabian Ebner
8265d0ce33 avoid backtick unicode symbol in string
Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
2021-07-01 18:27:27 +02:00