Wolfgang Bumiller
3626f57d2c
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>
2020-01-07 13:37:34 +01:00
Wolfgang Bumiller
45af06f090
api-macro: derive optional values correctly
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-01-07 13:19:13 +01:00
Wolfgang Bumiller
46fe5832fb
api-macro: reorganize field iteration
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-01-07 13:18:21 +01:00
Wolfgang Bumiller
9207e8aa9a
api-macro: error on extraneous fields
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-01-07 13:16:12 +01:00
Wolfgang Bumiller
860a4fd0ad
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>
2020-01-07 13:09:20 +01:00
Wolfgang Bumiller
e960a68b60
api-macro: factor out type inference for reuse with structs
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-01-07 13:09:08 +01:00
Wolfgang Bumiller
b9769de6b6
api-macro: split struct handling into newtype, regular, unit, ...
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-01-07 12:11:04 +01:00
Wolfgang Bumiller
4c77a7fece
api-macro: derive descriptions for structs
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-01-07 12:00:17 +01:00
Fabian Grünbichler
a6f21e7694
cargo: switch to use packaged crates by default
...
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-01-03 09:39:52 +01:00
Fabian Grünbichler
f667873d70
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>
2020-01-03 07:28:24 +01:00
Wolfgang Bumiller
43682dd416
version bump
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-01-02 14:42:28 +01:00
Wolfgang Bumiller
f214bcb652
api-macro: drop unused dev-dependencies
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-01-02 14:25:09 +01:00
Fabian Grünbichler
8bd5e82012
readme: add cargo config for packaged crates
...
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2020-01-02 14:07:12 +01:00
Fabian Grünbichler
94168b94c2
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>
2020-01-02 14:00:27 +01:00
Wolfgang Bumiller
b659584f23
sys: add a bunch of error helpers
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-01-02 13:47:53 +01:00
Wolfgang Bumiller
568ce10624
sys: add some helpful macros
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-01-02 13:47:53 +01:00
Wolfgang Bumiller
c52794b8ad
api-macro: bump bytes to 0.5
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2020-01-02 12:45:07 +01:00
Wolfgang Bumiller
1a2aaad5a1
more versioning fixups
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-30 12:33:13 +01:00
Wolfgang Bumiller
929161f030
-dev bump for proxmox crate as well
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-30 12:05:57 +01:00
Wolfgang Bumiller
496afe891e
add a 'Versioning' readme section
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-30 11:50:30 +01:00
Wolfgang Bumiller
09345ac8c5
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>
2019-12-30 11:32:21 +01:00
Wolfgang Bumiller
f90cbb7edd
tools: fs: default to 644 for mode in replace_file
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-30 10:06:40 +01:00
Fabian Grünbichler
c27369e136
proxmox: initial packaging
...
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-12-20 09:39:45 +01:00
Fabian Grünbichler
8840877c80
proxmox-api-macro: initial packaging
...
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-12-20 09:39:45 +01:00
Fabian Grünbichler
57565a5061
proxmox-sortable-macro: initial packaging
...
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-12-20 09:39:45 +01:00
Fabian Grünbichler
d6bf884814
proxmox-sys: initial packaging
...
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-12-20 09:39:45 +01:00
Fabian Grünbichler
f4d9e8157c
proxmox-sys: update lazy-static to 1.4
...
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-12-20 09:39:45 +01:00
Fabian Grünbichler
08433fd330
proxmox-api: use proxmox-tools package in d/rules
...
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-12-20 09:39:45 +01:00
Fabian Grünbichler
92c645cee2
proxmox-api: initial packaging
...
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-12-20 09:39:45 +01:00
Fabian Grünbichler
36f03c0feb
proxmox-api: update rustyline to 5.0.5
...
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-12-20 09:39:45 +01:00
Fabian Grünbichler
2ecd975608
proxmox-api: update lazy_static to 1.4
...
which is available in Debian unstable.
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-12-20 09:39:45 +01:00
Fabian Grünbichler
fa4f892c19
proxmox-tools: initial packaging
...
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-12-20 09:39:45 +01:00
Fabian Grünbichler
a33d9a35db
proxmox-tools: update regex and lazy_static
...
to those versions available in Debian unstable
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
2019-12-20 09:15:24 +01:00
Wolfgang Bumiller
2abdbb5113
add a top level doc comment to fs submodule
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-19 12:01:36 +01:00
Wolfgang Bumiller
ef612103f2
bump nix to 0.16
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-19 09:27:41 +01:00
Thomas Lamprecht
cfae8ae3d2
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>
2019-12-18 17:00:51 +01:00
Wolfgang Bumiller
1e7467ee11
cleanup
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-18 13:41:17 +01:00
Wolfgang Bumiller
85742a0d57
tools: create_path: return whether the dir was created
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-18 13:40:12 +01:00
Wolfgang Bumiller
867a530724
tools: create_dir: pass EEXIST to the caller
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-18 13:37:10 +01:00
Wolfgang Bumiller
3c284b131d
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>
2019-12-18 13:20:58 +01:00
Wolfgang Bumiller
5e1468bff8
formatting fixup
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-18 13:20:58 +01:00
Dietmar Maurer
d0349e9ba9
src/cli/format.rs - print_help: by default, use verbose output for simply commands
2019-12-18 13:08:18 +01:00
Thomas Lamprecht
13007df318
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>
2019-12-18 11:30:55 +01:00
Wolfgang Bumiller
81cac5fc29
replace create_dir_chown with create_dir using CreateOptions
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-18 11:09:23 +01:00
Wolfgang Bumiller
ffcbcc117a
deprecate file_set_contents{,_full}
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-18 10:46:28 +01:00
Wolfgang Bumiller
4bce3d76a2
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>
2019-12-18 10:04:22 +01:00
Wolfgang Bumiller
2387f9ef2b
tools: introduce replace_file
...
nicer api with CreateOptions
see doc-comments for more info
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-18 10:01:46 +01:00
Wolfgang Bumiller
1d65ff88dd
drop derive-builder dependency
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-18 10:00:30 +01:00
Wolfgang Bumiller
778983c1b0
remove old router macro documentation
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2019-12-18 09:40:40 +01:00
Wolfgang Bumiller
79c9d6ab08
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>
2019-12-16 13:06:58 +01:00