]> git.proxmox.com Git - proxmox.git/log
proxmox.git
4 years agobuild.sh: point to system compiler via rust-toolchain
Wolfgang Bumiller [Wed, 15 Jan 2020 15:25:14 +0000 (16:25 +0100)]
build.sh: point to system compiler via rust-toolchain

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoproxmox: fix proxmox-sys dependency version
Wolfgang Bumiller [Wed, 15 Jan 2020 14:56:06 +0000 (15:56 +0100)]
proxmox: fix proxmox-sys dependency version

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agobump package versions
Dietmar Maurer [Wed, 15 Jan 2020 14:39:47 +0000 (15:39 +0100)]
bump package versions

4 years agobump proxmox-sys to 0.1.2
Wolfgang Bumiller [Wed, 15 Jan 2020 14:34:26 +0000 (15:34 +0100)]
bump proxmox-sys to 0.1.2

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoREADME: Remove 'Versioning', add 'Steps for Releases'
Wolfgang Bumiller [Wed, 15 Jan 2020 13:26:06 +0000 (14:26 +0100)]
README: Remove 'Versioning', add 'Steps for Releases'

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agomacro: silence some warnings in tests
Wolfgang Bumiller [Wed, 15 Jan 2020 13:10:36 +0000 (14:10 +0100)]
macro: silence some warnings in tests

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoproxmox-api/src/cli/format.rs: improve generate_usage_str()
Dietmar Maurer [Wed, 15 Jan 2020 13:02:29 +0000 (14:02 +0100)]
proxmox-api/src/cli/format.rs: improve generate_usage_str()

List all arguments, and reduce empty lines.

4 years agoimprove build.sh
Wolfgang Bumiller [Wed, 15 Jan 2020 12:11:05 +0000 (13:11 +0100)]
improve build.sh

set $CARGO and $RUSTC env vars to also work for users with
rustup paths in their $PATH.

Replace $(pwd) with $PWD

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agobuild: switch to debcargo
Fabian Grünbichler [Wed, 15 Jan 2020 07:05:49 +0000 (08:05 +0100)]
build: switch to debcargo

to autogenerate crate (build)-dependencies, and correct Provides
statements.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agosys: add pid module with PidFd type
Wolfgang Bumiller [Wed, 15 Jan 2020 09:57:11 +0000 (10:57 +0100)]
sys: add pid module with PidFd type

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agosys: derive Clone and Debug for mount_info::Entry and MountInfo
Wolfgang Bumiller [Tue, 14 Jan 2020 14:18:09 +0000 (15:18 +0100)]
sys: derive Clone and Debug for mount_info::Entry and MountInfo

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agosys: use a BTreeMap for MountInfo internally
Wolfgang Bumiller [Tue, 14 Jan 2020 14:15:52 +0000 (15:15 +0100)]
sys: use a BTreeMap for MountInfo internally

Since the only reasonable access is by mount "id" and they
don't need to be consecutive (but they are numeric), use a
BTreeMap for MountInfo.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agosys: export MountInfo in procfs
Wolfgang Bumiller [Tue, 14 Jan 2020 13:56:03 +0000 (14:56 +0100)]
sys: export MountInfo in procfs

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agosys: more helpers for MountInfo
Wolfgang Bumiller [Tue, 14 Jan 2020 13:54:51 +0000 (14:54 +0100)]
sys: more helpers for MountInfo

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agosys: add /proc/self/mountinfo parsing
Wolfgang Bumiller [Tue, 14 Jan 2020 13:41:21 +0000 (14:41 +0100)]
sys: add /proc/self/mountinfo parsing

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agosys: Add TryFrom<Pid> for PidStat
Wolfgang Bumiller [Tue, 14 Jan 2020 11:05:04 +0000 (12:05 +0100)]
sys: Add TryFrom<Pid> for PidStat

Since nix's Pid type is a strong type, we can add a TryFrom
implementation here as well.
This can later also have the equivalent TryFrom<PidFd>
variant.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agosys: change PidStat API
Wolfgang Bumiller [Tue, 14 Jan 2020 11:01:06 +0000 (12:01 +0100)]
sys: change PidStat API

Rather than standalone functions, `PidStat` now provides a
`read_for_pid` and `parse` method. Both are public.
One side effect is that the documentation of PidStat's
contents are on the same page as the ways to retrieve it.

Additionally, we deprecate `read_proc_starttime` as it was
reading the entire contents to then filter out one value, in
order to promote caching.

The standalone `read_proc_pid_stat` method is now also
deprecated.

Once we add pid-fds the API will feel cleaner this way.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agosys: extend proc_pid_stat parsing
Wolfgang Bumiller [Tue, 14 Jan 2020 10:49:33 +0000 (11:49 +0100)]
sys: extend proc_pid_stat parsing

Rename `ProcFsPidStat` to `PidStat`. It's already in a
procfs submodule anyway. (We have currently no public users
of this type by name.)

Further add pid, ppid and num_threads to PidStat.

Public API change.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agotake a reference to the dirfd in Fd::openat
Wolfgang Bumiller [Tue, 14 Jan 2020 10:21:28 +0000 (11:21 +0100)]
take a reference to the dirfd in Fd::openat

Otherwise we cannot pass references to it unless the AsRawFd
implementation was made for the reference itself rather than
the type.

Note that while this changes the public API, we have no
users outside of this crate yet and no public releases,
so I'm not doing a major version bump.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agofixup provides list
Wolfgang Bumiller [Wed, 8 Jan 2020 13:26:12 +0000 (14:26 +0100)]
fixup provides list

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agofinish version bump
Wolfgang Bumiller [Wed, 8 Jan 2020 13:21:39 +0000 (14:21 +0100)]
finish version bump

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agobump proxmox to 0.1.2
Wolfgang Bumiller [Wed, 8 Jan 2020 13:14:11 +0000 (14:14 +0100)]
bump proxmox to 0.1.2

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agobump api-macro to 0.1.1
Wolfgang Bumiller [Wed, 8 Jan 2020 10:29:15 +0000 (11:29 +0100)]
bump api-macro to 0.1.1

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: even more documentation
Wolfgang Bumiller [Wed, 8 Jan 2020 10:28:00 +0000 (11:28 +0100)]
api-macro: even more documentation

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: more documentation
Wolfgang Bumiller [Wed, 8 Jan 2020 10:23:48 +0000 (11:23 +0100)]
api-macro: more documentation

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: schema tests for async fns
Wolfgang Bumiller [Wed, 8 Jan 2020 10:01:55 +0000 (11:01 +0100)]
api-macro: schema tests for async fns

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: more tests
Wolfgang Bumiller [Wed, 8 Jan 2020 09:58:26 +0000 (10:58 +0100)]
api-macro: more tests

Note that this one tests the fact that we do not do output
schema validation!

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: more invocation tests for api methods
Wolfgang Bumiller [Wed, 8 Jan 2020 09:56:45 +0000 (10:56 +0100)]
api-macro: more invocation tests for api methods

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: add expanded data to tests for verification
Wolfgang Bumiller [Wed, 8 Jan 2020 09:41:29 +0000 (10:41 +0100)]
api-macro: add expanded data to tests for verification

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi: add test-harness feature
Wolfgang Bumiller [Wed, 8 Jan 2020 09:22:41 +0000 (10:22 +0100)]
api: add test-harness feature

If enabled, the Schema type implements Eq and PartialEq for
testing the api macro better.

Note that these implementations don't make all too much
since since they also compare `dyn Fn` types which do not
implement Eq. Since they're also `&'static` they can't
really be runtime closures, so this should be fine, we know
they'll always point to some regular function.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: support empty api macro on structs
Wolfgang Bumiller [Wed, 8 Jan 2020 09:09:41 +0000 (10:09 +0100)]
api-macro: support empty api macro on structs

The description comes from the doc comment, the field types
and description from field doc comments and types.
Previously we needed to add at least the hint that the
schema is an object schema. Now we support an empty #[api]
attribute as well.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: support renamed struct fields
Wolfgang Bumiller [Wed, 8 Jan 2020 09:06:48 +0000 (10:06 +0100)]
api-macro: support renamed struct fields

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: support rename_all in enums
Wolfgang Bumiller [Tue, 7 Jan 2020 14:29:56 +0000 (15:29 +0100)]
api-macro: support rename_all in enums

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: start using serde attribute helpers
Wolfgang Bumiller [Tue, 7 Jan 2020 14:23:52 +0000 (15:23 +0100)]
api-macro: start using serde attribute helpers

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: prepare to support serde::rename_all
Wolfgang Bumiller [Tue, 7 Jan 2020 14:10:55 +0000 (15:10 +0100)]
api-macro: prepare to support serde::rename_all

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: more option type handling
Wolfgang Bumiller [Tue, 7 Jan 2020 12:37:33 +0000 (13:37 +0100)]
api-macro: more option type handling

infer_type now also returns whether it was encapsualted in
an Option<>. So `type: String, optional: true` is now
inferred propertly from `Option<String>`.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: derive optional values correctly
Wolfgang Bumiller [Tue, 7 Jan 2020 12:19:13 +0000 (13:19 +0100)]
api-macro: derive optional values correctly

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: reorganize field iteration
Wolfgang Bumiller [Tue, 7 Jan 2020 12:18:21 +0000 (13:18 +0100)]
api-macro: reorganize field iteration

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: error on extraneous fields
Wolfgang Bumiller [Tue, 7 Jan 2020 12:16:12 +0000 (13:16 +0100)]
api-macro: error on extraneous fields

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: add basic struct handling
Wolfgang Bumiller [Tue, 7 Jan 2020 12:09:19 +0000 (13:09 +0100)]
api-macro: add basic struct handling

- handle doc comments for descriptions
- infer fields from structs when possible
- perform some basic error checking

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: factor out type inference for reuse with structs
Wolfgang Bumiller [Tue, 7 Jan 2020 12:09:08 +0000 (13:09 +0100)]
api-macro: factor out type inference for reuse with structs

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: split struct handling into newtype, regular, unit, ...
Wolfgang Bumiller [Tue, 7 Jan 2020 11:11:04 +0000 (12:11 +0100)]
api-macro: split struct handling into newtype, regular, unit, ...

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: derive descriptions for structs
Wolfgang Bumiller [Tue, 7 Jan 2020 10:59:24 +0000 (11:59 +0100)]
api-macro: derive descriptions for structs

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agocargo: switch to use packaged crates by default
Fabian Grünbichler [Fri, 3 Jan 2020 08:39:52 +0000 (09:39 +0100)]
cargo: switch to use packaged crates by default

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agotools: remove accidentally commited debian/files
Fabian Grünbichler [Fri, 3 Jan 2020 06:28:24 +0000 (07:28 +0100)]
tools: remove accidentally commited debian/files

it's a build artifact, no need to version control it.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agoversion bump
Wolfgang Bumiller [Thu, 2 Jan 2020 13:35:40 +0000 (14:35 +0100)]
version bump

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: drop unused dev-dependencies
Wolfgang Bumiller [Thu, 2 Jan 2020 13:25:09 +0000 (14:25 +0100)]
api-macro: drop unused dev-dependencies

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoreadme: add cargo config for packaged crates
Fabian Grünbichler [Thu, 2 Jan 2020 13:07:12 +0000 (14:07 +0100)]
readme: add cargo config for packaged crates

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agoproxmox-tools: reference valgrind_request via git
Fabian Grünbichler [Thu, 2 Jan 2020 12:33:01 +0000 (13:33 +0100)]
proxmox-tools: reference valgrind_request via git

to allow using 'cargo XXX' with cargo config pointing to packaged
sources instead of crates.io

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agosys: add a bunch of error helpers
Wolfgang Bumiller [Thu, 2 Jan 2020 12:36:21 +0000 (13:36 +0100)]
sys: add a bunch of error helpers

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agosys: add some helpful macros
Wolfgang Bumiller [Thu, 2 Jan 2020 12:30:30 +0000 (13:30 +0100)]
sys: add some helpful macros

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: bump bytes to 0.5
Wolfgang Bumiller [Thu, 2 Jan 2020 11:45:07 +0000 (12:45 +0100)]
api-macro: bump bytes to 0.5

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agomore versioning fixups
Wolfgang Bumiller [Mon, 30 Dec 2019 11:33:13 +0000 (12:33 +0100)]
more versioning fixups

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years ago-dev bump for proxmox crate as well
Wolfgang Bumiller [Mon, 30 Dec 2019 11:05:57 +0000 (12:05 +0100)]
-dev bump for proxmox crate as well

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoadd a 'Versioning' readme section
Wolfgang Bumiller [Mon, 30 Dec 2019 10:50:30 +0000 (11:50 +0100)]
add a 'Versioning' readme section

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agobump proxmox-tools to 0.1.1-dev.1
Wolfgang Bumiller [Mon, 30 Dec 2019 10:27:37 +0000 (11:27 +0100)]
bump proxmox-tools to 0.1.1-dev.1

We now use this between package releases.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agotools: fs: default to 644 for mode in replace_file
Wolfgang Bumiller [Mon, 30 Dec 2019 09:05:57 +0000 (10:05 +0100)]
tools: fs: default to 644 for mode in replace_file

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoproxmox: initial packaging
Fabian Grünbichler [Wed, 18 Dec 2019 09:32:41 +0000 (10:32 +0100)]
proxmox: initial packaging

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agoproxmox-api-macro: initial packaging
Fabian Grünbichler [Tue, 17 Dec 2019 15:26:58 +0000 (16:26 +0100)]
proxmox-api-macro: initial packaging

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agoproxmox-sortable-macro: initial packaging
Fabian Grünbichler [Tue, 17 Dec 2019 15:22:33 +0000 (16:22 +0100)]
proxmox-sortable-macro: initial packaging

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agoproxmox-sys: initial packaging
Fabian Grünbichler [Tue, 17 Dec 2019 15:08:52 +0000 (16:08 +0100)]
proxmox-sys: initial packaging

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agoproxmox-sys: update lazy-static to 1.4
Fabian Grünbichler [Tue, 17 Dec 2019 15:05:49 +0000 (16:05 +0100)]
proxmox-sys: update lazy-static to 1.4

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agoproxmox-api: use proxmox-tools package in d/rules
Fabian Grünbichler [Tue, 17 Dec 2019 14:35:48 +0000 (15:35 +0100)]
proxmox-api: use proxmox-tools package in d/rules

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agoproxmox-api: initial packaging
Fabian Grünbichler [Tue, 17 Dec 2019 14:16:01 +0000 (15:16 +0100)]
proxmox-api: initial packaging

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agoproxmox-api: update rustyline to 5.0.5
Fabian Grünbichler [Tue, 17 Dec 2019 14:16:06 +0000 (15:16 +0100)]
proxmox-api: update rustyline to 5.0.5

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agoproxmox-api: update lazy_static to 1.4
Fabian Grünbichler [Tue, 17 Dec 2019 14:01:07 +0000 (15:01 +0100)]
proxmox-api: update lazy_static to 1.4

which is available in Debian unstable.

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agoproxmox-tools: initial packaging
Fabian Grünbichler [Tue, 17 Dec 2019 13:46:11 +0000 (14:46 +0100)]
proxmox-tools: initial packaging

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agoproxmox-tools: update regex and lazy_static
Fabian Grünbichler [Tue, 17 Dec 2019 13:46:35 +0000 (14:46 +0100)]
proxmox-tools: update regex and lazy_static

to those versions available in Debian unstable

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
4 years agoadd a top level doc comment to fs submodule
Wolfgang Bumiller [Thu, 19 Dec 2019 11:01:36 +0000 (12:01 +0100)]
add a top level doc comment to fs submodule

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agobump nix to 0.16
Wolfgang Bumiller [Thu, 19 Dec 2019 08:26:52 +0000 (09:26 +0100)]
bump nix to 0.16

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agolinux/procfs: add read_proc_stat
Thomas Lamprecht [Wed, 18 Dec 2019 11:45:31 +0000 (12:45 +0100)]
linux/procfs: add read_proc_stat

For now we just parse the CPU "time-spent" counters and calculate the
CPU usage of the whole system. As we do not want a total average we
use a state-full implementation, which calculates the usage since the
last request (if older than 1 second).

Somewhat modeled after our Perl version of this. But for the "total"
we do not use the:
> ($ctime - $last_proc_stat->{ctime}) * $clock_ticks * $cpucount;
calculation, but just add _all_ fields together, as that is the total
of CPU time.

Use a Reader-Writer lock to sync updating. First check under the
reader lock if the data is recent enough, else update it under the
writer lock.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
4 years agocleanup
Wolfgang Bumiller [Wed, 18 Dec 2019 12:41:17 +0000 (13:41 +0100)]
cleanup

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agotools: create_path: return whether the dir was created
Wolfgang Bumiller [Wed, 18 Dec 2019 12:40:11 +0000 (13:40 +0100)]
tools: create_path: return whether the dir was created

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agotools: create_dir: pass EEXIST to the caller
Wolfgang Bumiller [Wed, 18 Dec 2019 12:37:10 +0000 (13:37 +0100)]
tools: create_dir: pass EEXIST to the caller

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agotools: fix create_path: don't use O_PATH
Wolfgang Bumiller [Wed, 18 Dec 2019 12:13:43 +0000 (13:13 +0100)]
tools: fix create_path: don't use O_PATH

open(2) says file descriptors opened with O_PATH cannot be
passed to fchmod(), fchown(), etc.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoformatting fixup
Wolfgang Bumiller [Wed, 18 Dec 2019 12:13:34 +0000 (13:13 +0100)]
formatting fixup

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agosrc/cli/format.rs - print_help: by default, use verbose output for simply commands
Dietmar Maurer [Wed, 18 Dec 2019 12:06:39 +0000 (13:06 +0100)]
src/cli/format.rs - print_help: by default, use verbose output for simply commands

4 years agoapi/macro: add NumberSchema
Thomas Lamprecht [Wed, 18 Dec 2019 10:14:57 +0000 (11:14 +0100)]
api/macro: add NumberSchema

Adapted from the integer schema, uses f64 type.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Cc: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoreplace create_dir_chown with create_dir using CreateOptions
Wolfgang Bumiller [Wed, 18 Dec 2019 10:09:23 +0000 (11:09 +0100)]
replace create_dir_chown with create_dir using CreateOptions

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agodeprecate file_set_contents{,_full}
Wolfgang Bumiller [Wed, 18 Dec 2019 09:46:28 +0000 (10:46 +0100)]
deprecate file_set_contents{,_full}

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agotools: replace_file, make options not an option...
Wolfgang Bumiller [Wed, 18 Dec 2019 09:04:21 +0000 (10:04 +0100)]
tools: replace_file, make options not an option...

CreateOptions::new() creates an all-None option set anyway

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agotools: introduce replace_file
Wolfgang Bumiller [Wed, 18 Dec 2019 09:00:54 +0000 (10:00 +0100)]
tools: introduce replace_file

nicer api with CreateOptions
see doc-comments for more info

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agodrop derive-builder dependency
Wolfgang Bumiller [Wed, 18 Dec 2019 09:00:30 +0000 (10:00 +0100)]
drop derive-builder dependency

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoremove old router macro documentation
Wolfgang Bumiller [Wed, 18 Dec 2019 08:40:40 +0000 (09:40 +0100)]
remove old router macro documentation

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: remove now-unnecessary PropertySchema type
Wolfgang Bumiller [Mon, 16 Dec 2019 12:06:57 +0000 (13:06 +0100)]
api-macro: remove now-unnecessary PropertySchema type

Schemas can now generally refer to an externally defined
schema.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: generalized '{ schema: PATH }' schemas
Wolfgang Bumiller [Mon, 16 Dec 2019 11:11:52 +0000 (12:11 +0100)]
api-macro: generalized '{ schema: PATH }' schemas

allow 'schema: PATH' outside object property context

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi-macro: support 'async fn' with new async api method
Wolfgang Bumiller [Mon, 16 Dec 2019 10:13:26 +0000 (11:13 +0100)]
api-macro: support 'async fn' with new async api method

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoimplement ApiHandler::Async
Dietmar Maurer [Mon, 16 Dec 2019 08:53:25 +0000 (09:53 +0100)]
implement ApiHandler::Async

4 years agoapi: update url crate to 2.1
Wolfgang Bumiller [Fri, 13 Dec 2019 10:30:06 +0000 (11:30 +0100)]
api: update url crate to 2.1

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoupdate bytes to 0.5
Wolfgang Bumiller [Thu, 12 Dec 2019 14:35:36 +0000 (15:35 +0100)]
update bytes to 0.5

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoformatting fixup
Wolfgang Bumiller [Thu, 12 Dec 2019 14:35:30 +0000 (15:35 +0100)]
formatting fixup

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoupdates for hyper 0.13 release
Wolfgang Bumiller [Thu, 12 Dec 2019 12:06:40 +0000 (13:06 +0100)]
updates for hyper 0.13 release

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoproxmox-api/src/cli.rs: simplify cli setup using generics.
Dietmar Maurer [Mon, 9 Dec 2019 16:38:18 +0000 (17:38 +0100)]
proxmox-api/src/cli.rs: simplify cli setup using generics.

4 years agoproxmox-api/src/cli/format.rs - generate_nested_usage: fix formating with empty prefix
Dietmar Maurer [Fri, 6 Dec 2019 09:13:12 +0000 (10:13 +0100)]
proxmox-api/src/cli/format.rs - generate_nested_usage: fix formating with empty prefix

4 years agoapi: add 'router' and 'cli' features
Wolfgang Bumiller [Thu, 5 Dec 2019 12:36:05 +0000 (13:36 +0100)]
api: add 'router' and 'cli' features

Move API types into the router module and make router and
cli optional.

This way the 'router' module is the only thing with a
dependency on 'hyper', allowing the use of the schema alone
without pulling in the entire hyper stack.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoapi: use http::{Parts,Response,Method}
Wolfgang Bumiller [Thu, 5 Dec 2019 12:18:19 +0000 (13:18 +0100)]
api: use http::{Parts,Response,Method}

hyper just reexports them

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agomore clippy fixups
Wolfgang Bumiller [Thu, 5 Dec 2019 11:28:05 +0000 (12:28 +0100)]
more clippy fixups

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoclippy fixups
Wolfgang Bumiller [Thu, 5 Dec 2019 10:35:33 +0000 (11:35 +0100)]
clippy fixups

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoformatting fixup
Wolfgang Bumiller [Thu, 5 Dec 2019 10:33:12 +0000 (11:33 +0100)]
formatting fixup

please run `make` to check formatting before committing

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
4 years agoformatting fixup
Wolfgang Bumiller [Thu, 5 Dec 2019 10:32:48 +0000 (11:32 +0100)]
formatting fixup

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>