diff options
| author | Rob van der Linde <rob@catalyst.net.nz> | 2023-11-07 18:45:30 +1300 |
|---|---|---|
| committer | Andrew Bartlett <abartlet@samba.org> | 2023-11-15 04:05:34 +0000 |
| commit | 2f20fa9b90af637b7e5ca8c6227f74f710da170e (patch) | |
| tree | d95c7ae944e3b79fd235f1744fd1f050fa025cbc /python/samba/netcmd | |
| parent | 30992e865c5abe61147ca7f4288ff9f13bd4dc11 (diff) | |
| download | samba-2f20fa9b90af637b7e5ca8c6227f74f710da170e.tar.gz samba-2f20fa9b90af637b7e5ca8c6227f74f710da170e.tar.bz2 samba-2f20fa9b90af637b7e5ca8c6227f74f710da170e.zip | |
netcmd: silo member: Make output consistent with user command
* Use print with file=self.outf
* Show assigned or unassigned silo
Signed-off-by: Rob van der Linde <rob@catalyst.net.nz>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Diffstat (limited to 'python/samba/netcmd')
| -rw-r--r-- | python/samba/netcmd/domain/auth/silo_member.py | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/python/samba/netcmd/domain/auth/silo_member.py b/python/samba/netcmd/domain/auth/silo_member.py index f9ec2686cf1..af5fbc0913b 100644 --- a/python/samba/netcmd/domain/auth/silo_member.py +++ b/python/samba/netcmd/domain/auth/silo_member.py @@ -75,7 +75,14 @@ class cmd_domain_auth_silo_member_add(Command): except ModelError as e: raise CommandError(e) - self.outf.write(f"User {user} added to the authentication silo {name}.\n") + # Display silo assigned status. + if user.assigned_silo and user.assigned_silo == silo.dn: + status = "assigned" + else: + status = "unassigned" + + print(f"User {user} added to the authentication silo {name} ({status}).", + file=self.outf) class cmd_domain_auth_silo_member_list(Command): @@ -122,7 +129,7 @@ class cmd_domain_auth_silo_member_list(Command): self.print_json([member.as_dict() for member in members]) else: for member in members: - self.outf.write(f"{member.dn}\n") + print(member.dn, file=self.outf) class cmd_domain_auth_silo_member_remove(Command): @@ -174,7 +181,14 @@ class cmd_domain_auth_silo_member_remove(Command): except ModelError as e: raise CommandError(e) - self.outf.write(f"User {user} removed from the authentication silo {name}.\n") + # Display silo assigned status. + if user.assigned_silo and user.assigned_silo == silo.dn: + status = "assigned" + else: + status = "unassigned" + + print(f"User {user} removed from the authentication silo {name} ({status}).", + file=self.outf) class cmd_domain_auth_silo_member(SuperCommand): |
