Commit Graph

1023 Commits

Author SHA1 Message Date
Wolfgang Bumiller
cb96de1c4d bump proxmox-api-macro to 0.5.1-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-08-30 10:46:05 +02:00
Wolfgang Bumiller
14bd81fbc4 doc: update UpdaterType documentation
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-08-30 08:21:08 +02:00
Wolfgang Bumiller
76641b0a72 api-macro: allow external schemas in 'returns' specification
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-08-26 13:34:23 +02:00
Wolfgang Bumiller
bf84e75603 api: move ReturnType from router to schema
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-08-26 11:39:55 +02:00
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
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
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
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
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
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
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
Fabian Grünbichler
fff7b926ee proxmox-http: bump version to 0.2.1
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2021-05-18 10:31:51 +02:00
Fabian Grünbichler
480e213f7c websocket: add note about compat removal
this major release still needs to have an incompatible, the next one can
drop setting a protocol client-side, and the one after that can remove
the protocol handling on the server side.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2021-05-18 09:26:51 +02:00
Dominik Csapak
0786b4b98c proxmox-http/websocket: remove subprotocol handling
we do not support websocket subprotocols, but for compatibility with
current clients (novnc, pve-xtermjs) we have to reply with the one requested,
else this is a protocol error and browsers will error out

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2021-05-18 09:22:05 +02:00
Dominik Csapak
232d87531e proxmox-http/websocket: remove code for 'text' frames
we never actually sent text frames, nor did any client request them.
Also, no validity check ever ocurred, so technically it was against
the spec.

Simply remove the code handling sending out text frames. If we need
to actually handle that, we can always create a 'WebSocketStringWriter'
or similar.

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2021-05-18 09:22:05 +02:00
Wolfgang Bumiller
e0dcc337ac rustfmt fixup
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-05-17 12:25:49 +02:00
Wolfgang Bumiller
242a6ab216 doc fixups
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-05-17 11:39:11 +02:00
Wolfgang Bumiller
44a2cab602 bump d/control
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-05-17 11:38:52 +02:00
Wolfgang Bumiller
0c448080c8 bump proxmox-http to 0.2.0-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-05-17 11:25:42 +02:00
Wolfgang Bumiller
76c25a9612 add some more module level docs
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-05-17 11:25:42 +02:00
Wolfgang Bumiller
c9b4a4f39b uri: drop anyhow::Error and improve docs
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-05-17 11:25:42 +02:00
Wolfgang Bumiller
ca9dd7ec36 reorganize crate
it's a 'http' utility crate
* the extra 'http' module is redundant
* the module name 'helpers' as a public path doesn't say
  much about what it does

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2021-05-17 11:03:31 +02:00
Dietmar Maurer
3a161119c2 update proxmox/debian/control 2021-05-17 10:21:54 +02:00
Dietmar Maurer
47e6ae52ff bump proxmox version to 0.11.5-1 2021-05-17 10:07:28 +02:00
Fabian Grünbichler
37ae288efd http: update d/control
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2021-05-17 09:54:32 +02:00
Fabian Grünbichler
94378967e3 http: rustfmt
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2021-05-17 09:54:01 +02:00
Fabian Grünbichler
910949db01 http: make clippy happy
again.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2021-05-17 09:53:42 +02:00
Fabian Grünbichler
667bd8ab83 http: takeover simple HTTP client from proxmox_backup
adapted to use already moved helpers/code.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2021-05-17 09:53:18 +02:00
Fabian Grünbichler
80b423f30f http: takeover tools::http from proxmox_backup
the parts that were not already moved.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2021-05-17 09:53:04 +02:00
Fabian Grünbichler
7f56e0774c http: takeover ProxyConfig from proxmox_backup
adapted to use moved build_authority helper.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2021-05-17 09:52:29 +02:00
Fabian Grünbichler
f305be9583 http: takeover build_authority helper from proxmox_backup
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2021-05-17 09:45:35 +02:00
Fabian Grünbichler
6c5028512b http: takeover MaybeTlsStream from proxmox_backup
this is just a (rather HTTP specific) wrapper, so put it into a
'wrapper' module for now.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2021-05-17 09:45:04 +02:00
Fabian Grünbichler
caef9a3b20 proxmox: takeover socket helper from proxmox_backup
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2021-05-17 09:43:51 +02:00