[pve-devel] applied: [PATCH common v3 0/5] sub command for CLI helper
Thomas Lamprecht
t.lamprecht at proxmox.com
Thu Jan 18 09:51:00 CET 2018
On 1/18/18 9:26 AM, Wolfgang Bumiller wrote:
> applied whole series
Thanks!
As the current libpve-common-perl version bump (5.0-26) now contains
the sub-command and the fork_woker series, both changes to core
elements, it may warrant some longer testing periods, e.g. on pvetest,
IMO.
> On Tue, Jan 09, 2018 at 01:25:28PM +0100, Thomas Lamprecht wrote:
>> v3 of the sub command for CLI series. v2 can be found here:
>> https://pve.proxmox.com/pipermail/pve-devel/2017-December/029916.html
>>
>> This are the remaining, not yet applied, patches from the sub command
>> series, which was initially developed by Philip and reworked and
>> split up by myself.
>>
>> This version should address the comments from Wolfgangs review (thanks
>> for that again!). More details in the specific patches.
>>
>> Attached at the end of this cover letter is a patch for implementing
>> sub commands and their aliases for the pveum tool (pve-access-control
>> repo).
>>
>> Thomas Lamprecht (5):
>> cli: refactor print_bash_completion
>> cli: factor out generate usage string
>> cli: allow specifying sub commands through $cmddef
>> cli: allow to pass sub commands to help as array
>> cli: document $cmddef structure
>>
>> src/PVE/CLIHandler.pm | 306 +++++++++++++++++++++++++++++++++-----------------
>> 1 file changed, 201 insertions(+), 105 deletions(-)
>>
>> --
>> 2.11.0
>>
>> ----8<----
>> diff --git a/PVE/CLI/pveum.pm b/PVE/CLI/pveum.pm
>> index aef7089..a4e584d 100755
>> --- a/PVE/CLI/pveum.pm
>> +++ b/PVE/CLI/pveum.pm
>> @@ -38,6 +38,25 @@ sub read_password {
>> }
>>
>> our $cmddef = {
>> + user => {
>> + add => [ 'PVE::API2::User', 'create_user', ['userid'] ],
>> + modify => [ 'PVE::API2::User', 'update_user', ['userid'] ],
>> + delete => [ 'PVE::API2::User', 'delete_user', ['userid'] ],
>> + },
>> + group => {
>> + add => [ 'PVE::API2::Group', 'create_group', ['groupid'] ],
>> + modify => [ 'PVE::API2::Group', 'update_group', ['groupid'] ],
>> + delete => [ 'PVE::API2::Group', 'delete_group', ['groupid'] ],
>> + },
>> + role => {
>> + add => [ 'PVE::API2::Role', 'create_role', ['roleid'] ],
>> + modify => [ 'PVE::API2::Role', 'update_role', ['roleid'] ],
>> + delete => [ 'PVE::API2::Role', 'delete_role', ['roleid'] ],
>> + },
>> + acl => {
>> + modify => [ 'PVE::API2::ACL', 'update_acl', ['path'], { delete => 0 }],
>> + delete => [ 'PVE::API2::ACL', 'update_acl', ['path'], { delete => 1 }],
>> + },
>> ticket => [ 'PVE::API2::AccessControl', 'create_ticket', ['username'], undef,
>> sub {
>> my ($res) = @_;
>> @@ -46,20 +65,20 @@ our $cmddef = {
>>
>> passwd => [ 'PVE::API2::AccessControl', 'change_passsword', ['userid'] ],
>>
>> - useradd => [ 'PVE::API2::User', 'create_user', ['userid'] ],
>> - usermod => [ 'PVE::API2::User', 'update_user', ['userid'] ],
>> - userdel => [ 'PVE::API2::User', 'delete_user', ['userid'] ],
>> + useradd => { alias => 'user add' },
>> + usermod => { alias => 'user modify' },
>> + userdel => { alias => 'user delete' },
>>
>> - groupadd => [ 'PVE::API2::Group', 'create_group', ['groupid'] ],
>> - groupmod => [ 'PVE::API2::Group', 'update_group', ['groupid'] ],
>> - groupdel => [ 'PVE::API2::Group', 'delete_group', ['groupid'] ],
>> + groupadd => { alias => 'group add' },
>> + groupmod => { alias => 'group modify' },
>> + groupdel => { alias => 'group delete' },
>>
>> - roleadd => [ 'PVE::API2::Role', 'create_role', ['roleid'] ],
>> - rolemod => [ 'PVE::API2::Role', 'update_role', ['roleid'] ],
>> - roledel => [ 'PVE::API2::Role', 'delete_role', ['roleid'] ],
>> + roleadd => { alias => 'role add' },
>> + rolemod => { alias => 'role modify' },
>> + roledel => { alias => 'role delete' },
>>
>> - aclmod => [ 'PVE::API2::ACL', 'update_acl', ['path'], { delete => 0 }],
>> - acldel => [ 'PVE::API2::ACL', 'update_acl', ['path'], { delete => 1 }],
>> + aclmod => { alias => 'acl modify' },
>> + acldel => { alias => 'acl delete' },
>> };
>>
>> 1;
>> ---->8----
>
> ^ git & patch didn't like that, works when ending it with just two
> minus instead:
> --
>
OK, good to know.
More information about the pve-devel
mailing list