summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorTim Beale <timbeale@catalyst.net.nz>2018-07-27 13:26:23 +1200
committerAndrew Bartlett <abartlet@samba.org>2018-08-17 02:58:27 +0200
commit1a30a68b4a33b5aaacf768b489bf4e444d03ff5a (patch)
tree0cff1a79876db93a8d0e26fefb60dd00b71019c0 /python
parent30e6e04c4c0dd9ed4277f88006f2d59247e86590 (diff)
downloadsamba-1a30a68b4a33b5aaacf768b489bf4e444d03ff5a.tar.gz
Fix PEP8 warning E225 missing whitespace around operator
Signed-off-by: Tim Beale <timbeale@catalyst.net.nz> Reviewed-by: Andrew Bartlett <abartlet@samba.org> Reviewed-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Diffstat (limited to 'python')
-rw-r--r--python/samba/netcmd/pso.py20
-rw-r--r--python/samba/tests/pso.py12
-rw-r--r--python/samba/tests/samba_tool/passwordsettings.py14
3 files changed, 24 insertions, 22 deletions
diff --git a/python/samba/netcmd/pso.py b/python/samba/netcmd/pso.py
index e43886eb23b..f0f733885d9 100644
--- a/python/samba/netcmd/pso.py
+++ b/python/samba/netcmd/pso.py
@@ -412,7 +412,8 @@ class cmd_domain_pwdsettings_pso_create(Command):
if num == ldb.ERR_INSUFFICIENT_ACCESS_RIGHTS:
raise CommandError("Administrator permissions are needed to create a PSO.")
else:
- raise CommandError("Failed to create PSO '%s': %s" %(pso_dn, msg))
+ raise CommandError("Failed to create PSO '%s': %s" % (pso_dn,
+ msg))
class cmd_domain_pwdsettings_pso_set(Command):
"""Modifies a Password Settings Object (PSO)."""
@@ -489,7 +490,7 @@ class cmd_domain_pwdsettings_pso_set(Command):
show_pso_by_dn(self.outf, samdb, pso_dn, show_applies_to=False)
except ldb.LdbError as e:
(num, msg) = e.args
- raise CommandError("Failed to update PSO '%s': %s" %(pso_dn, msg))
+ raise CommandError("Failed to update PSO '%s': %s" % (pso_dn, msg))
class cmd_domain_pwdsettings_pso_delete(Command):
@@ -572,7 +573,7 @@ class cmd_domain_pwdsettings_pso_list(Command):
for pso in pso_list:
precedence = pso['msDS-PasswordSettingsPrecedence']
- self.outf.write("%-10s | %s\n" %(precedence, pso['name']))
+ self.outf.write("%-10s | %s\n" % (precedence, pso['name']))
class cmd_domain_pwdsettings_pso_show(Command):
"""Display a Password Settings Object's details."""
@@ -693,10 +694,10 @@ class cmd_domain_pwdsettings_pso_apply(Command):
raise CommandError("PSO '%s' already applies to '%s'"
% (psoname, user_or_group))
else:
- raise CommandError("Failed to update PSO '%s': %s" %(psoname,
- msg))
+ raise CommandError("Failed to update PSO '%s': %s" % (psoname,
+ msg))
- self.message("PSO '%s' applied to '%s'" %(psoname, user_or_group))
+ self.message("PSO '%s' applied to '%s'" % (psoname, user_or_group))
class cmd_domain_pwdsettings_pso_unapply(Command):
@@ -752,9 +753,10 @@ class cmd_domain_pwdsettings_pso_unapply(Command):
raise CommandError("PSO '%s' doesn't apply to '%s'"
% (psoname, user_or_group))
else:
- raise CommandError("Failed to update PSO '%s': %s" %(psoname,
- msg))
- self.message("PSO '%s' no longer applies to '%s'" %(psoname, user_or_group))
+ raise CommandError("Failed to update PSO '%s': %s" % (psoname,
+ msg))
+ self.message("PSO '%s' no longer applies to '%s'" % (psoname,
+ user_or_group))
class cmd_domain_passwordsettings_pso(SuperCommand):
"""Manage fine-grained Password Settings Objects (PSOs)."""
diff --git a/python/samba/tests/pso.py b/python/samba/tests/pso.py
index 76c8d46e90b..d6ebf50e46d 100644
--- a/python/samba/tests/pso.py
+++ b/python/samba/tests/pso.py
@@ -33,8 +33,8 @@ class TestUser:
initial_password = "Initial12#"
self.name = username
self.ldb = samdb
- self.dn = "CN=%s,%s,%s" %(username, (userou or "CN=Users"),
- self.ldb.domain_dn())
+ self.dn = "CN=%s,%s,%s" % (username, (userou or "CN=Users"),
+ self.ldb.domain_dn())
# store all passwords that have ever been used for this user, as well
# as a pwd_history that more closely resembles the history on the DC
@@ -154,9 +154,9 @@ class PasswordSettings:
Returns a object representing the default password settings that will
take effect (i.e. when no other Fine-Grained Password Policy applies)
"""
- pw_attrs=["minPwdAge", "lockoutDuration", "lockOutObservationWindow",
- "lockoutThreshold", "maxPwdAge", "minPwdAge", "minPwdLength",
- "pwdHistoryLength", "pwdProperties"]
+ pw_attrs = ["minPwdAge", "lockoutDuration", "lockOutObservationWindow",
+ "lockoutThreshold", "maxPwdAge", "minPwdAge",
+ "minPwdLength", "pwdHistoryLength", "pwdProperties"]
res = samdb.search(samdb.domain_dn(), scope=ldb.SCOPE_BASE,
attrs=pw_attrs)
@@ -195,7 +195,7 @@ class PasswordSettings:
container = "CN=Password Settings Container,CN=System,%s" % base_dn
self.name = name
- self.dn = "CN=%s,%s" %(name, container)
+ self.dn = "CN=%s,%s" % (name, container)
self.ldb = samdb
self.precedence = precedence
self.complexity = complexity
diff --git a/python/samba/tests/samba_tool/passwordsettings.py b/python/samba/tests/samba_tool/passwordsettings.py
index 353756c4931..c6577bb6a3d 100644
--- a/python/samba/tests/samba_tool/passwordsettings.py
+++ b/python/samba/tests/samba_tool/passwordsettings.py
@@ -44,7 +44,7 @@ class PwdSettingsCmdTestCase(SambaToolCmdTest):
"""Checks the PSO info in the DB matches what's expected"""
# lookup the PSO in the DB
- dn = "CN=%s,%s" %(pso_name, self.pso_container)
+ dn = "CN=%s,%s" % (pso_name, self.pso_container)
pso_attrs = ['name', 'msDS-PasswordSettingsPrecedence',
'msDS-PasswordReversibleEncryptionEnabled',
'msDS-PasswordHistoryLength', 'msDS-MinimumPasswordLength',
@@ -113,7 +113,7 @@ class PwdSettingsCmdTestCase(SambaToolCmdTest):
"-H", self.server,
self.user_auth)
# make sure we clean-up after the test completes
- self.obj_cleanup.append("CN=%s,%s" %(pso_name, self.pso_container))
+ self.obj_cleanup.append("CN=%s,%s" % (pso_name, self.pso_container))
self.assertCmdSuccess(result, out, err)
self.assertEquals(err,"","Shouldn't be any error messages")
@@ -156,7 +156,7 @@ class PwdSettingsCmdTestCase(SambaToolCmdTest):
"--max-pwd-age=50",
"-H", self.server,
self.user_auth)
- self.obj_cleanup.append("CN=%s,%s" %(pso_name, self.pso_container))
+ self.obj_cleanup.append("CN=%s,%s" % (pso_name, self.pso_container))
self.assertCmdSuccess(result, out, err)
self.assertEquals(err,"","Shouldn't be any error messages")
self.assertIn("successfully created", out)
@@ -185,7 +185,7 @@ class PwdSettingsCmdTestCase(SambaToolCmdTest):
"-H", self.server,
self.user_auth)
# make sure we clean-up after the test completes
- pso_settings.dn = "CN=%s,%s" %(pso_name, self.pso_container)
+ pso_settings.dn = "CN=%s,%s" % (pso_name, self.pso_container)
self.obj_cleanup.append(pso_settings.dn)
# sanity-check the cmd was successful
@@ -234,7 +234,7 @@ class PwdSettingsCmdTestCase(SambaToolCmdTest):
self.assertCmdSuccess(result, out, err)
self.assertEquals(err,"","Shouldn't be any error messages")
self.assertIn("Deleted PSO", out)
- dn = "CN=%s,%s" %(pso_name, self.pso_container)
+ dn = "CN=%s,%s" % (pso_name, self.pso_container)
self.obj_cleanup.remove(dn)
# check the object no longer exists in the DB
@@ -287,7 +287,7 @@ class PwdSettingsCmdTestCase(SambaToolCmdTest):
# add the user to a new group
group_name = "test-PSO-group"
- dn = "CN=%s,%s" %(group_name, self.ldb.domain_dn())
+ dn = "CN=%s,%s" % (group_name, self.ldb.domain_dn())
self.ldb.add({"dn": dn, "objectclass": "group",
"sAMAccountName": group_name})
self.obj_cleanup.append(dn)
@@ -349,7 +349,7 @@ class PwdSettingsCmdTestCase(SambaToolCmdTest):
self._create_pso(pso_name)
user = TestUser("test-unpriv-user", self.ldb)
self.obj_cleanup.append(user.dn)
- unpriv_auth = "-U%s%%%s" %(user.name, user.get_password())
+ unpriv_auth = "-U%s%%%s" % (user.name, user.get_password())
# check we need admin privileges to be able to do anything to PSOs
(result, out, err) = self.runsublevelcmd("domain", ("passwordsettings",