Groups for occ command and UI testing#28190
Conversation
Signed-off-by: Phil Davis <phil@jankaritech.com>
Signed-off-by: Phil Davis <phil@jankaritech.com>
Signed-off-by: Phil Davis <phil@jankaritech.com>
|
@SergioBertolinSG this implements issue #20629 which you raised and is in 10.0 backlog. Having group commands in occ is very useful for the UI testing scenario steps, and will be useful for other things also (even sysadmins who want to create and manage groups from the command line) |
|
@PVince81 @DeepDiver1975 this expands functionality of |
|
@PVince81 please review and set proper milestone. Thanks |
| $group->removeUser($user); | ||
| $output->writeln('User "' . $user->getUID() . '" removed from group "' . $group->getGID() . '"'); | ||
| } else { | ||
| $output->writeln('<error>User "' . $userName . '" could not be found in group "' . $group->getGID() . '"</error>'); |
There was a problem hiding this comment.
should this maybe affect the command's return code ? should we abort ?
There was a problem hiding this comment.
I wonder what to do in these sort of cases. The sysadmin has asked to remove user1 from group1. Actually user1 is already not in group1, so the requested state is already the case and the occ command is a NOOP.
Do we tell the sysadmin "the user is already not in the group"?
Do we mark the text as an error? (because actually what the sysadmin asked is done)
Do we return an error code, or success?
There was a problem hiding this comment.
not sure, maybe check what other system tools do. Does "groupdel" on Linux return an error code ?
|
As a CLI user I'd be confused as to what command to use for adding users to a group. I know that I'd prefer having separate commands with clearer names:
|
| $group = $this->groupManager->get($groupName); | ||
| if (is_null($group)) { | ||
| $output->writeln('<error>Group does not exist</error>'); | ||
| return; |
There was a problem hiding this comment.
Similar thing here - should this text even be highlighted as an error?
The sysadmin asked to delete the group, the group is not even existing, so it is indeed deleted.
| return; | ||
| } | ||
|
|
||
| $output->writeln('<error>The specified group could not be deleted. Please check the logs.</error>'); |
There was a problem hiding this comment.
Yes, I better return an error code here - this one is the system having trouble!
| $output->writeln('The group "' . $group->getGID() . '" already exists'); | ||
| } | ||
|
|
||
| $users = $input->getOption('user'); |
There was a problem hiding this comment.
please move this to a separate command, much clearer from a user's perspective.
Also I guess that the current impl would not let you add users to an existing group as you'd get "Group already exists" which sounds like an error even though the code carries on.
PVince81
left a comment
There was a problem hiding this comment.
See comments.
Make sure to return an error code in all execute commands when non-zero. It can help with scripting.
Also note that runOcc can check said error code in case it's useful for testing.
Signed-off-by: Phil Davis <phil@jankaritech.com>
Signed-off-by: Phil Davis <phil@jankaritech.com>
|
I can do group:add group:addmember group:removemember and group:delete OK from the command line. If I addmember and some users are already in the group, I do not emit an error. IMHO that is an OK condition - a scripting person can do group:addmember for all the users that they want to be in the group and do not need to try and thin if they are already in the group. Similarly, if I removemember and some users were already removed from the group, I do not emit an error. That lets a scripting person do removemember for any user(s) that they want to make sure are not in the group without worrying if they were already removed. Let's see if CI is happy... |
|
@phil-davis please backport to stable10. Ignoring the old rule "don't backport new features". cc @DeepDiver1975 @felixboehm |
|
Actually, the reason to backport this is that
the fact that it also provides an enhancement/feature to the occ command, which end-users will see and can use in 10.0.3, is actually just "collateral damage" :) |
|
and this has been, and will be, a common thing for both new test infrastructure and new tests. Generally-speaking it will be "a good thing" that a more extensive set of automated tests runs in the 10.0.* series. |
|
@phil-davis thanks, makes sense |
|
@PVince81 @phil-davis @settermjd |
that were added by owncloud/core#28190 and backported to stable10 by owncloud/core#28276 so the occ group commands will become available from 10.0.3
|
Doc PR owncloud-archive/documentation#3201 created. |
|
Q: maybe I missed that: |
|
@mmattel that is a good question that I also asked myself. But I did not want to start expanding beyond what I really needed because then people might review and say "why did you add xyz?" IMHO it would be very handy for oC admins to be able to list users and groups from the command line. |
|
@phil-davis mind to add this list functinality? |
|
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Description
Related Issue
Addresses #20629 to provide occ group command
for which some initial work happened in #21627
Also part of providing base infrastructure for UI testing #27858
Motivation and Context
How Has This Been Tested?
Self-testing - Travis does it
Types of changes
Checklist:
Once this is accepted, the documentation of the occ group command needs to be done.