Commit Graph

2972 Commits

Author SHA1 Message Date
Wolfgang Bumiller
2598699fcb daemon: remove useless comment
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-24 16:30:14 +02:00
Wolfgang Bumiller
35372b5337 daemon: boxed FnOnce has been usable for a while
While technically an API break, we don't use the public API for this
anywhere and the trait we're changing is explicitly marked as
`#[doc(hidden)]`.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-24 16:27:32 +02:00
Wolfgang Bumiller
4502bc3b73 acme-api: bump to 0.1.4-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-24 14:33:36 +02:00
Wolfgang Bumiller
150f203209 auth-api: bump to 0.4.4
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-24 14:32:28 +02:00
Wolfgang Bumiller
15200b9f64 rest-server: bump to 0.7.0-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-24 14:32:01 +02:00
Wolfgang Bumiller
921d2bcc13 daemon: bump to 0.1.0-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-24 14:29:06 +02:00
Wolfgang Bumiller
f67c651929 systemd: bump to 0.1.0-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-24 14:29:06 +02:00
Wolfgang Bumiller
b54b4d3324 log: bump to 0.2.0-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-24 14:29:06 +02:00
Wolfgang Bumiller
d3abd366c4 introduce proxmox-daemon crate
split from rest-server:
- "state" module (shutdown/reload state)
- shutdown futures
- "daemon" module (named 'server' module in proxmox-daemon)
- command socket

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-24 14:25:50 +02:00
Wolfgang Bumiller
fb1a75d48f systemd: add fd-store support
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-24 14:25:50 +02:00
Wolfgang Bumiller
2783f062a6 update rest-server to use proxmox-systemd crate
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-24 14:25:50 +02:00
Wolfgang Bumiller
ab41d326e4 introduce proxmox-systemd crate
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-24 14:25:50 +02:00
Gabriel Goller
cecd08df58 log: remove unused init_logger argument
The `_application_name` argument is not used anymore. It was previously
used to set the correct journald unit-name, which is now handled
automatically.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
2024-07-24 14:25:50 +02:00
Wolfgang Bumiller
a38b46b27d rest-server: drop proxmox-io dependency
Used only for read/writing a pid_t (an integer) to a socket.
The standard to_ne_bytes()/from_ne_bytes() should be sufficient here,
we already have libc::pid_t which we can use to get the correct type
namespace for accessing ::from_ne_bytes().

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-24 14:06:40 +02:00
Wolfgang Bumiller
c0e5776edd log: fix filter condition for journal layer
The condition was inverted, it would only send to the journal for
worker tasks.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-24 14:05:51 +02:00
Wolfgang Bumiller
f2130b69c8 router: bump to 2.2.1-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-22 09:07:22 +02:00
Wolfgang Bumiller
45a1e580c8 access-control: bump to 0.2.2-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-22 09:05:28 +02:00
Wolfgang Bumiller
5eb7cbd250 cli: deal with commands without positional args
When reaching the final command we relied on the positional parameters
"ending" the global option parsing. This means we did not get global
options at the end, and failed with "unknown option" instead.
Fix this by simply retaining unknown options in that case and not
stopping at positional parameters.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-22 09:03:56 +02:00
Wolfgang Bumiller
fee00addab access-control: add init_user_config() method
So that we can make sure root@pam exists at the product level.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-22 09:03:56 +02:00
Wolfgang Bumiller
140fc0ad08 access-control: cleanup use statements
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-22 09:03:56 +02:00
Maximiliano Sandoval
c8b975799b fix typos in strings
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
2024-07-22 08:49:42 +02:00
Maximiliano Sandoval
c88cdd7e67 fix typos in variable and function names
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
2024-07-22 08:49:42 +02:00
Maximiliano Sandoval
254a37ae07 fix typos in code documentation
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
2024-07-22 08:49:42 +02:00
Maximiliano Sandoval
72ab48eb55 fix typos in rust api documentation
Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
2024-07-22 08:49:42 +02:00
Maximiliano Sandoval
a50d2c715e rest-server: Encode with zlib headers
As per [RFC9110] the Deflate encoding is a "zlib" data format. This
makes the rest-server compatible with the http-client.

[RFC9110] https://www.rfc-editor.org/rfc/rfc9110#field.content-encoding

Signed-off-by: Maximiliano Sandoval <m.sandoval@proxmox.com>
Reviewed-by: Max Carrara <m.carrara@proxmox.com>
Tested-by: Max Carrara <m.carrara@proxmox.com>
2024-07-22 08:11:14 +02:00
Gabriel Goller
500fb592f9 log: reorder filters as a small optimization
Reorder the filters for the journald layer. This sets the LevelFilter
last, which means tracing can disable all log statements lower than the
current level without evaluating the LogContext::exists function.

Signed-off-by: Gabriel Goller <g.goller@proxmox.com>
 [ TL: note that this is just an optimization in the subject ]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-07-18 12:11:43 +02:00
Wolfgang Bumiller
5262cefd34 router: bump to 2.2.0-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-17 14:28:07 +02:00
Wolfgang Bumiller
ff17bf5a2b router: don't deprecate generate_usage_str
This is used for the 'debug' binary to show the usage of an API
method.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-17 14:28:07 +02:00
Wolfgang Bumiller
3dc013bb57 schema: bump to 3.1.2-1
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-17 14:18:04 +02:00
Wolfgang Bumiller
4de22b9728 api-macro: fix warnigns
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-17 13:43:37 +02:00
Wolfgang Bumiller
cff04a4502 router: cli: add parser option tests
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-17 13:43:37 +02:00
Wolfgang Bumiller
492cac4346 router: cli: simplify parsing logic
Deduplicate the check for whether the argument exists by trying to
fetch the schema once and use check the option instead of calling
'.contains_key()' multiple times.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-17 13:43:37 +02:00
Wolfgang Bumiller
9288c00372 router: cli: move freestanding new parse loop into its method
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-17 13:43:37 +02:00
Wolfgang Bumiller
95c0614ccd router: cli: improve doc-gen global options handling
Passing the &GlobalOptions through is more telling than an opaque
Iterator<&str>...

Also: actually generate the property descriptions in non-ReST mode for
global options as well, so the `help` output for a specific command
includes the property documentation instead of only showing the name.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-17 13:43:37 +02:00
Wolfgang Bumiller
d872eb9d7e router: cli: rework newline handling for doc and help output
The rules are as follows:
- An "item" by itself does neither start nor end with a newline.
- Where items are connected, the appropriate amount of newlines must
  be inserted, assuming items do not have any trailing newlines.

Otherwise this just gets WAY too confusing everywhere!

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-17 13:43:37 +02:00
Wolfgang Bumiller
667fa6bc6b router: cli: doc generation with global options
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-17 13:43:37 +02:00
Wolfgang Bumiller
69c2f94aab schema: drop extra newline in proeprty description
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-17 13:43:37 +02:00
Wolfgang Bumiller
f02ce77ad6 schema: make wrap_text less awkward
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-17 13:43:37 +02:00
Wolfgang Bumiller
dc7273e888 schema: drop trailing double-newlines in wrap_text
This is completely wrong and make working with it extremely annoying.
Whether or not there should be separation should be decided where
multiple elements are connected, they shouldn't automatically come
with a bunch of trailing new lines for absolutely no reason.

Places using this will need to be fixed as they get noticed.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-17 13:43:37 +02:00
Wolfgang Bumiller
d240ef1e92 router: set help context on help invocation
instead of during parsing...

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-17 13:43:37 +02:00
Wolfgang Bumiller
83b3c1794a router: completion callbacks for global options
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-17 13:43:37 +02:00
Wolfgang Bumiller
afe746b02f router: let completion take global options into account
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-17 13:43:37 +02:00
Wolfgang Bumiller
420e238126 router: hook help/completion/docgen into new cli parser
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-17 13:43:37 +02:00
Wolfgang Bumiller
eb5614adf1 router: new cli parser with global option support
This one does *explicitly* *not* support long options with a single
dash because it is too ambiguous if we want to add support for short
options at some point.

The parsing of the command line and invoking of the command is
separated. `CommandLine::parse` returns an `Invocation` which is
called and consumed via its `call` method.
This allows updating the CLI environment between parsing and invoking
the command, in order to allow *handling* the global options in
between those two steps if desired.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-17 13:43:37 +02:00
Wolfgang Bumiller
59f1bdbe85 router: cli: store extra CLI args by type
The CLI environment can now contain ApiType structs which can be
accessed by their type.
The TypeId is used since the options inside must be unique anyway and
we can't have the same type specified multiple times. It also makes
for a somewhat convenient interface:

    env.take_global_option::<ConnectInfo>()

where ConnectInfo is a struct containing the server, user, port, ...
since these will not be passed as *parameters* to the API functions.

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-17 13:43:37 +02:00
Wolfgang Bumiller
41b08323a7 router: AsAny: add as_any_mut
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2024-07-17 13:43:37 +02:00
Thomas Lamprecht
f78c28dd11 acme: update d/control
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-07-17 11:41:11 +02:00
Thomas Lamprecht
d1aa14eb71 apt: bump version to 0.11.2-1
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-07-17 11:39:46 +02:00
Thomas Lamprecht
f41664e087 workspace: bump dependency for apt-api-types to 1.0.1
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-07-17 10:07:43 +02:00
Thomas Lamprecht
301e268fc4 apt-api-types: bump version to 1.0.1-1
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2024-07-17 09:54:33 +02:00