]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
netcmd: silos: silo and auth policy commands use print
authorRob van der Linde <rob@catalyst.net.nz>
Mon, 26 Feb 2024 04:06:30 +0000 (17:06 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Fri, 1 Mar 2024 04:45:36 +0000 (04:45 +0000)
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 <rob@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
python/samba/netcmd/domain/auth/policy.py
python/samba/netcmd/domain/auth/silo.py
python/samba/netcmd/domain/claim/claim_type.py
python/samba/netcmd/domain/claim/value_type.py

index f65cff2738114e71fe26b922eae9d70e7bb66f43..f5347cdaa034020179ae9ce3443dae0edee1d71d 100644 (file)
@@ -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):
index d35d5f716db4c85555e16641c71e610f865a27c2..410b04fc702c9a2e09eee4665d27962d7806dd32 100644 (file)
@@ -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):
index 72e98d33125aac3519715bf1c0cac9325b26074d..109f79c0a030aebddb49d51db0ae1011a35c875e 100644 (file)
@@ -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):
index a26111338ca43ff4e835240771688c8f5ffdb1bb..a15f7c5757015fdd7006c642d2ce045cf7a06c23 100644 (file)
@@ -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):