IF YOU WOULD LIKE TO GET AN ACCOUNT, please write an
email to Administrator. User accounts are meant only to access repo
and report issues and/or generate pull requests.
This is a purpose-specific Git hosting for
BaseALT
projects. Thank you for your understanding!
Только зарегистрированные пользователи имеют доступ к сервису!
Для получения аккаунта, обратитесь к администратору.
Not only because <=> is correct, but using 'cmp' also has
the side effect that it adds a string version to the
variable and the API's json output turns into a string as
well, and this only happens once a task has completed
(while it's an integer while it's still running...)
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
this implements those parts of draft-ietf-acme-acme-09 which are needed
to use Let's Encrypt's v2 API.
(based on an internal implement for the Let's Encrypt v1 API)
Co-Authored-By: Wolfgang Bumiller <w.bumiller@proxmox.com>
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
since we sometimes use their length in a format string for printf
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
Co-authored-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Instead of hardcoding 'password' as a special case in the
JSONSchema's getopt handling, extend the new parameter
mapping to allow defining a parameters as 'interactive'.
They also take an optional argument on the command line
directly.
This effectively deprecates the password special case which
should be replaced in pct/pveum/... and then dropped in
pve-common.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
track our command string, i.e. everything which cannot be an argument
for a specific command, in resolve_cmd, as we go through the commando
definition there anyway and know if a ARGV element is part of the
command itself or its arguments.
Fixes a problem where a invalid command had all the passed parameter
attached in the resulting USAGE output.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
the timegm(gmtime()) and timelocal(localtime(()) constructs are
problematic in the following case: - $last is such that $year gets set
to a two-digit value (e.g., the referred to timestamp is somewhere in
the range of 1900-1999) - the current date is such that the value of
$year gets interpreted wrongly (e.g., anything other than 1950).
the exact breakage depends on the actual current date AND value of
$last, since localtime/gmtime will interpret two-digit years as (perldoc
Time::Local):
[...] shorthand for years in the rolling "current century," defined
as 50 years on either side of the current year. Thus, today, in
1999, 0 would refer to 2000, and 45 to 2045, but 55 would refer to
1955. Twenty years from now, 55 would instead refer to 2055.
fix it by adding 1900 to force 4-digit $year values, as the localtime
documentation suggests.
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
We don't use them and iproute2 4.13.0 has an issue parsing
parameters after a policing description.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
For sub commands we resolve the real $cmd, $def and its arguments,
thus we should also get the handler from the resolved $def, not the
global one.
No change for normal (consisting of only the first argument)
commands, for them $cmddef == $def.
This sneaked in in a respin/rebase of the series.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Improves usabillity by allowing to pass a sub copmmand unquoted to
the help command, e.g.:
# pveum help user delete
without this only a quoted version worked, e.g.:
# pveum help "user delete"
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Acked-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
allow to use sub commands alá
# pveum user add
The new resolve_cmd traverses $cmddef, resolves one level of aliases
and returns the respective sub command, its cmddef, arguments and if
it was expanded (e.g., pveum u d ... => pveum user delete ...) which
allows quite easy integration in the usage/synopsis generator, bash
completion helper and command handler.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
move variables nearer to where they actually used.
drop program name early from argv array
drop unnecessary variables
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
As it might die with an error which should end up in the
_exit() code path rather than bailing out into the upper
scope.
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Reviewed-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
$resfh can be a pipe from POSIX::pipe() or the upid output
handle, which is an IO::File, so we need to take its
fileno().
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Fixes: ed52a8435a ("fork_worker: use separate pipe for status messages")
Reviewed-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
will be reused in later patches too
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
Acked-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
use shorter and also a bit faster methods to expand and get comand
names
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Acked-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
passing one param less to the helper methods
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
Reviewed-by: Dominik Csapak <d.csapak@proxmox.com>
Acked-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
Without this patch we printed to STDOUT and STDERR, respectively, if
no $outfunc or $errfunc was passed.
Sometimes it's useful if one, or even both, of those prints can
be suppressed, currently this can only be done by either using an array
of arrays or a whole string for the command and redirecting STDOUT
and STDERR.
Add a 'quiet' option which allows to do this in an easier way.
It allows to silent STDERR or STDOUT or both.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
When running in sync (CLI environment) we mirror the workers output
to both, STDOUT and th task log file, a similar function as the unix
comand line tool tee provides, thus we borrow its name for the
factored out sub method.
This moves ~60 lines of code out of the big fork_worker sub and makes
it easier to read track what happens there.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
We forced line wise flushing of the workers STDOUT and STDERR to
capture the final status (TASK OK/TASK ERROR).
Thus, if the code executed in the worker wanted to flush explicitly,
e.g., when the last output wasn't new line terminated but needed to
reach the users eyes, the parent just ignored that.
This leads to confusing results in CLI handlers using fork_workers.
So remove the buffering logic completely and introduce a separate
pipe for sending the final status.
Said pipe gets once read after the child closes (EOF) its STDOUT.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>