From: Rob van der Linde Date: Mon, 26 Feb 2024 04:06:30 +0000 (+1300) Subject: netcmd: silos: silo and auth policy commands use print X-Git-Tag: tdb-1.4.11~1557 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9238afc16c6eeb79543f063b283f511929df67f0;p=thirdparty%2Fsamba.git netcmd: silos: silo and auth policy commands use print This adds more consistency with newer code added after these commands. But also print seems more flexible and requires no newline characters added constantly which ends up being a bit cleaner. Signed-off-by: Rob van der Linde Reviewed-by: Andrew Bartlett Reviewed-by: Douglas Bagnall --- diff --git a/python/samba/netcmd/domain/auth/policy.py b/python/samba/netcmd/domain/auth/policy.py index f65cff27381..f5347cdaa03 100644 --- a/python/samba/netcmd/domain/auth/policy.py +++ b/python/samba/netcmd/domain/auth/policy.py @@ -200,7 +200,7 @@ class cmd_domain_auth_policy_list(Command): self.print_json(policies) else: for policy in policies.keys(): - self.outf.write(f"{policy}\n") + print(policy, file=self.outf) class cmd_domain_auth_policy_view(Command): @@ -413,7 +413,7 @@ class cmd_domain_auth_policy_create(Command): raise CommandError(e) # Authentication policy created successfully. - self.outf.write(f"Created authentication policy: {name}\n") + print(f"Created authentication policy: {name}", file=self.outf) class cmd_domain_auth_policy_modify(Command): @@ -621,7 +621,7 @@ class cmd_domain_auth_policy_modify(Command): raise CommandError(e) # Authentication policy updated successfully. - self.outf.write(f"Updated authentication policy: {name}\n") + print(f"Updated authentication policy: {name}", file=self.outf) class cmd_domain_auth_policy_delete(Command): @@ -670,7 +670,7 @@ class cmd_domain_auth_policy_delete(Command): raise CommandError(e) # Authentication policy deleted successfully. - self.outf.write(f"Deleted authentication policy: {name}\n") + print(f"Deleted authentication policy: {name}", file=self.outf) class cmd_domain_auth_policy(SuperCommand): diff --git a/python/samba/netcmd/domain/auth/silo.py b/python/samba/netcmd/domain/auth/silo.py index d35d5f716db..410b04fc702 100644 --- a/python/samba/netcmd/domain/auth/silo.py +++ b/python/samba/netcmd/domain/auth/silo.py @@ -61,7 +61,7 @@ class cmd_domain_auth_silo_list(Command): self.print_json(silos) else: for silo in silos.keys(): - self.outf.write(f"{silo}\n") + print(silo, file=self.outf) class cmd_domain_auth_silo_view(Command): @@ -212,7 +212,7 @@ class cmd_domain_auth_silo_create(Command): raise CommandError(e) # Authentication silo created successfully. - self.outf.write(f"Created authentication silo: {name}\n") + print(f"Created authentication silo: {name}", file=self.outf) class cmd_domain_auth_silo_modify(Command): @@ -337,7 +337,7 @@ class cmd_domain_auth_silo_modify(Command): raise CommandError(e) # Silo updated successfully. - self.outf.write(f"Updated authentication silo: {name}\n") + print(f"Updated authentication silo: {name}", file=self.outf) class cmd_domain_auth_silo_delete(Command): @@ -386,7 +386,7 @@ class cmd_domain_auth_silo_delete(Command): raise CommandError(e) # Authentication silo deleted successfully. - self.outf.write(f"Deleted authentication silo: {name}\n") + print(f"Deleted authentication silo: {name}", file=self.outf) class cmd_domain_auth_silo(SuperCommand): diff --git a/python/samba/netcmd/domain/claim/claim_type.py b/python/samba/netcmd/domain/claim/claim_type.py index 72e98d33125..109f79c0a03 100644 --- a/python/samba/netcmd/domain/claim/claim_type.py +++ b/python/samba/netcmd/domain/claim/claim_type.py @@ -135,11 +135,10 @@ class cmd_domain_claim_claim_type_create(Command): raise CommandError(e) # Claim type created successfully. - self.outf.write(f"Created claim type: {display_name}") + message = f"Created claim type: {display_name}" if attribute_name != display_name: - self.outf.write(f" ({attribute_name})\n") - else: - self.outf.write("\n") + message += f" ({attribute_name})" + print(message, file=self.outf) class cmd_domain_claim_claim_type_modify(Command): @@ -226,7 +225,7 @@ class cmd_domain_claim_claim_type_modify(Command): raise CommandError(e) # Claim type updated successfully. - self.outf.write(f"Updated claim type: {name}\n") + print(f"Updated claim type: {name}", file=self.outf) class cmd_domain_claim_claim_type_delete(Command): @@ -275,7 +274,7 @@ class cmd_domain_claim_claim_type_delete(Command): raise CommandError(e) # Claim type deleted successfully. - self.outf.write(f"Deleted claim type: {name}\n") + print(f"Deleted claim type: {name}", file=self.outf) class cmd_domain_claim_claim_type_list(Command): @@ -311,7 +310,7 @@ class cmd_domain_claim_claim_type_list(Command): self.print_json(claim_types) else: for claim_type in claim_types.keys(): - self.outf.write(f"{claim_type}\n") + print(claim_type, file=self.outf) class cmd_domain_claim_claim_type_view(Command): diff --git a/python/samba/netcmd/domain/claim/value_type.py b/python/samba/netcmd/domain/claim/value_type.py index a26111338ca..a15f7c57570 100644 --- a/python/samba/netcmd/domain/claim/value_type.py +++ b/python/samba/netcmd/domain/claim/value_type.py @@ -59,7 +59,7 @@ class cmd_domain_claim_value_type_list(Command): self.print_json(value_types) else: for value_type in value_types.keys(): - self.outf.write(f"{value_type}\n") + print(value_type, file=self.outf) class cmd_domain_claim_value_type_view(Command):