Dietmar Maurer
ffe4449cd5
cli: print_text_table: fix for poperties without schema
...
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2018-06-27 11:46:29 +02:00
Thomas Lamprecht
8379465981
cli: print_text_table: followup code cleanup
...
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-06-27 11:28:40 +02:00
Thomas Lamprecht
9ac6416ec8
cli: print_text_table: default to autosort on
...
we more often want to sort by the leftmost valid column than not.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-06-27 11:23:31 +02:00
Thomas Lamprecht
fa7d20bf9f
cli: print_api_result: simplify props_to_print code
...
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-06-27 11:00:55 +02:00
Dietmar Maurer
8dd3280b55
PVE::CLIHandler::print_text_table - cleanup, directly use json schema data
...
This way we can access all type information and can use that to sort
numeric columns correctly.
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2018-06-27 11:00:29 +02:00
Dietmar Maurer
505786f6a4
PVE::CLIHandler::print_text_table - add option $sort_key
...
Now, we do not change the ordering by default.
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2018-06-27 11:00:23 +02:00
Stoiko Ivanov
16f2033235
PVE::CLIHandler::data_to_text: return '' for undef
...
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2018-06-27 11:00:19 +02:00
Dietmar Maurer
c1e843677d
PVE::CLIHandler::print_api_result - add $props_to_print parameter
...
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2018-06-27 11:00:12 +02:00
Stoiko Ivanov
db5b22d16a
PVE::CLIHandler::print_api_list: update comment
...
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2018-06-25 12:09:59 +02:00
Stoiko Ivanov
9b8f2f8f6e
PVE::CLIHandler::print_api_list - use all occuring properties
...
print_api_list falls back to the union of all properties occuring in data, if
none are provided explicitly, and the API method contains no returns property.
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2018-06-25 12:09:42 +02:00
Stoiko Ivanov
e05f7cdd0c
PVE::CLIHandler::print_text_table - fix sorting
...
Sort only if at least one column contains no undefined values.
Sort according to the left-most such column.
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2018-06-25 12:09:14 +02:00
Dietmar Maurer
ec3cbded33
cleanup: rename $returninfo to $result_schema
2018-06-22 07:37:09 +02:00
Dietmar Maurer
2edb0abbb9
PVE::CLIHandler::print_api_list - improve format check
...
We can only print lists of objects.
2018-06-22 07:32:33 +02:00
Dietmar Maurer
8587474c36
PVE::CLIHandler::print_api_list - reorder arguments
...
Move optional argument to the end.
2018-06-22 07:14:04 +02:00
Dietmar Maurer
eb04f1e26c
PVE::CLIHandler::print_api_list - allow to pass empty $props_to_print
2018-06-22 07:12:42 +02:00
Dietmar Maurer
340c98629c
PVE::CLIHandler - new helper print_api_result
...
Allow to print complex object/array by simply converting them to JSON.
Note: Our API almost always return simply values.
2018-06-22 07:05:23 +02:00
Thomas Lamprecht
ba49de85b9
cli: print table: remove only-once-used default variable
2018-06-20 14:12:18 +02:00
Stoiko Ivanov
eb3dae233f
cli: print_text_table: ensure default is not undefined
...
Default to printing '', if no default is provided for a column.
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2018-06-20 14:01:31 +02:00
Wolfgang Bumiller
f6c4a56381
INotify: write network: don't duplicate bridge-vids
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2018-06-20 10:27:08 +02:00
Alexandre Derumier
b7c4f37851
Inotify : write network config : remove allow- ovs with ifupdown2
2018-06-20 10:11:48 +02:00
Alexandre Derumier
95d0e63377
Inotify : write network config : add bridge-vids
...
default is 2-4094 if user don't have specified.
mandatory for ifupdown2 and compatible with
current promox ifupdown bridgevlanport script
2018-06-20 10:11:48 +02:00
Alexandre Derumier
1accc6da65
Inotify : write network config : use modern syntax for options
...
-replace options with '_' with '-'
-use 'bond-slaves' instead 'slaves'
2018-06-20 10:11:48 +02:00
Alexandre Derumier
1b1fb9f70c
Inotify : read network config : allow alternative options names
2018-06-20 10:11:48 +02:00
Thomas Lamprecht
37f010e7c6
fixup: don't standard mapping code in mid of cmd helpers
...
as it teared code which belongs together apart
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-06-19 12:33:26 +02:00
Dominik Csapak
0da61ab3c3
CLIHandler: add standard mapping for password parameter
...
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-06-19 11:56:00 +02:00
Dominik Csapak
57d5edee2f
CLIHandler: add standard_mappings
...
so we can reuse often used parameter mappings
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-06-19 11:56:00 +02:00
Dominik Csapak
a1c7eddaf1
add the possibility to use a hash for parameter mapping
...
instead of writing:
['name', sub {...}, 'description', 1]
one can now use:
{
name => 'name',
func => sub { ... },
desc => 'desc',
interactive => 1,
}
which makes it more obvious what is what
(and allows later patches to easily override some things)
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-06-19 11:56:00 +02:00
Thomas Lamprecht
305fc1e12a
print_api_list: we only handle API results of type 'array'
...
...for now at least
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-06-18 12:35:04 +02:00
Thomas Lamprecht
85b9def289
improve and fix some whitespace errors
...
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-06-18 12:34:58 +02:00
Thomas Lamprecht
acd6f38373
reword print_text_table and print_api_list documentation
...
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-06-18 12:34:55 +02:00
Stoiko Ivanov
a604bf2214
add print_api_list, adapt handle_cmd
...
print_api_list takes an array of columns to print, the data, and the returns
definitions of the API, and prints the data by using print_text_table.
handle_cmd and handle_simple_cmd call the output sub with the returns definitons.
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2018-06-18 11:24:03 +02:00
Stoiko Ivanov
8042c2cc62
add print_text_table, print_entry to CLIHandler
...
These two function could serve as a generic output sub for various CLI
utilities
* print_text_table prints an array of objects in a tabular fashion,
the formating is passed as an array containg hashes with titles, maximal
lengths and default values. This way we can stay extensible, by adding other
keys to the formatting options
* print_entry prints out a single entry, handling array-refs as properties
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2018-06-18 11:24:03 +02:00
Stoiko Ivanov
f8d4eff923
add print_width property to JSONSchema definition
...
used to define the maximal width of the respective column in the CLI
Signed-off-by: Stoiko Ivanov <s.ivanov@proxmox.com>
2018-06-18 11:24:03 +02:00
Thomas Lamprecht
a73f417f10
buildsys: depend on check target instead of manual calling it
...
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-06-18 08:57:25 +02:00
Thomas Lamprecht
82ad3144ff
buildsys: refactor distclean and clean target
...
remove the cleanup of the not produced ${PACKAGE}-*.tar.gz file.
This is here since the import from SVN, but is not needed since quite
a time.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-06-18 08:57:25 +02:00
Thomas Lamprecht
dbaa6e520a
buildsys: introduce BUILDDIR variable
...
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-06-18 08:57:25 +02:00
Thomas Lamprecht
f943f4d13e
buildsys: remove useless variable definitions
...
the used ones are in src/Makefile, so remove those left over, else
one could get confused why there on two places and why changes here
had no effect.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-06-18 08:57:25 +02:00
Thomas Lamprecht
008c3bb2d4
bump version to 5.0-34
2018-06-15 12:06:42 +02:00
Thomas Lamprecht
8461a4875a
d/control: record that we now break qemu-server << 5.0-29
...
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-06-15 12:06:42 +02:00
Thomas Lamprecht
eae436871c
rename splitted out systemd module to 'Systemd'
...
see:
https://www.freedesktop.org/wiki/Software/systemd/#spelling
We keep the initial upercase 'S' as it's standard for perl module
and perl critic complains otherwise.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-06-15 12:06:42 +02:00
Wolfgang Bumiller
f024a872c4
add PVE::SystemD module
...
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2018-06-15 11:33:17 +02:00
Wolfgang Bumiller
5a94ed9d9e
Perl::Cricit fixups
...
- fix variable declared in conditional statement
- add newlines to die/warn statements
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2018-06-14 11:41:41 +02:00
Thomas Lamprecht
a76b691d13
bump version to 5.0-33
2018-06-14 09:26:12 +02:00
Dietmar Maurer
2c48a66569
fix regex quoting in $print_bash_completion
...
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2018-06-14 09:09:10 +02:00
Wolfgang Bumiller
ea5a508493
cli: use exists() for alias check
...
should be faster
Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
2018-06-14 09:02:47 +02:00
Thomas Lamprecht
131f316b5c
cli: only show subcommand specific usage if command incomplete
...
before:
$ pveum acl
ERROR: incomplete command 'pveum acl'
USAGE: pveum <COMMAND> [ARGS] [OPTIONS]
pveum acl delete <path> --roles <string> [OPTIONS]
pveum acl modify <path> --roles <string> [OPTIONS]
pveum group add <groupid> [OPTIONS]
pveum group delete <groupid>
pveum group modify <groupid> [OPTIONS]
pveum role add <roleid> [OPTIONS]
pveum role delete <roleid>
pveum role modify <roleid> --privs <string> [OPTIONS]
pveum user add <userid> [OPTIONS]
pveum user delete <userid>
pveum user modify <userid> [OPTIONS]
pveum passwd <userid>
pveum ticket <username> [OPTIONS]
pveum help [<extra-args>] [OPTIONS]
after:
$ pveum acl
ERROR: incomplete command 'pveum acl'
USAGE: pveum <COMMAND> [ARGS] [OPTIONS]
pveum acl delete <path> --roles <string> [OPTIONS]
pveum acl modify <path> --roles <string> [OPTIONS]
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-06-14 08:58:54 +02:00
Thomas Lamprecht
0b79680694
cli: filter out aliases when trying to expand command
...
we do not complete them in bash copletion either and their just there
for backward compatibillity, so filter them out.
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-06-14 08:58:54 +02:00
Thomas Lamprecht
24ccf353c7
generate_usage_str: show short usage help for unknown commands
...
followup for previous commit to show the full short usage string for
the CLI tool in the case of an unknown command
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
2018-06-13 08:31:25 +02:00
Dietmar Maurer
57c0d0c69c
generate_usage_str: do no generate help for unknown commands
...
Before:
...
USAGE: pvesm aaa zfsscan
With this patch applied:
no such command 'aaa'
Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
2018-06-13 08:16:45 +02:00
Dominik Csapak
ac927fbcfd
add a generalized 'read and confirm password' sub
...
to use everywhere we read two passwords and compare them
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
2018-06-12 14:59:16 +02:00