security_AccountsBaseline: fix style.
BUG=None
TEST=Passes on spring, results copied correctly.
Change-Id: I8fdd8346ccb425c66b4b6b1e5aed8f92604261ab
Reviewed-on: https://chromium-review.googlesource.com/183010
Commit-Queue: Jorge Lucangeli Obes <jorgelo@chromium.org>
Tested-by: Jorge Lucangeli Obes <jorgelo@chromium.org>
Reviewed-by: Kees Cook <keescook@chromium.org>
diff --git a/client/site_tests/security_AccountsBaseline/security_AccountsBaseline.py b/client/site_tests/security_AccountsBaseline/security_AccountsBaseline.py
index b7541c1..aad509e 100644
--- a/client/site_tests/security_AccountsBaseline/security_AccountsBaseline.py
+++ b/client/site_tests/security_AccountsBaseline/security_AccountsBaseline.py
@@ -19,8 +19,8 @@
def capture_files(self):
for f in ['passwd','group']:
- shutil.copyfile(os.path.join('/etc',f),
- os.path.join(self.resultsdir,f))
+ shutil.copyfile(os.path.join('/etc', f),
+ os.path.join(self.resultsdir, f))
def run_once(self):
@@ -35,26 +35,26 @@
if len(passwd_actual) != len(passwd_baseline):
failed = True
logging.error('User baseline mismatch. '
- 'Expected: %d users. Got: %d.' % (
- len(passwd_baseline), len(passwd_actual)))
+ 'Expected: %d users. Got: %d.',
+ len(passwd_baseline), len(passwd_actual))
for expected in passwd_baseline:
got = [x for x in passwd_actual if x[0] == expected[0]]
if not got:
failed = True
- logging.error('No passwd entry for %s' % expected[0])
+ logging.error('No passwd entry for %s', expected[0])
continue
got = got[0]
# Match uid (3rd field) and gid (4th field).
if (expected[2], expected[3]) != (got[2], got[3]):
failed = True
logging.error(
- 'Expected uid/gid (%s, %s) for user %s. Got (%s, %s)' %
- (expected[2], expected[3], got[0], got[2], got[3]))
+ 'Expected uid/gid (%s, %s) for user %s. Got (%s, %s)',
+ expected[2], expected[3], got[0], got[2], got[3])
for actual in passwd_actual:
got = [x for x in passwd_baseline if x[0] == actual[0]]
if not got:
failed = True
- logging.error('Unexpected passwd entry for %s' % actual[0])
+ logging.error('Unexpected passwd entry for %s', actual[0])
# Match groups
group_baseline = self.load_path(os.path.join(
@@ -64,30 +64,30 @@
if len(group_actual) != len(group_baseline):
failed = True
logging.error('Group baseline mismatch. '
- 'Expected: %d groups. Got: %d.' % (
- len(group_baseline), len(group_actual)))
+ 'Expected: %d groups. Got: %d.',
+ len(group_baseline), len(group_actual))
for expected in group_baseline:
got = [x for x in group_actual if x[0] == expected[0]]
if not got:
failed = True
- logging.error('No group entry for %s' % expected[0])
+ logging.error('No group entry for %s', expected[0])
continue
got = got[0]
# Match gid (3rd field) and members (4th field. comma separated).
if expected[2] != got[2]:
failed = True
- logging.error('Expected id %s for group %s). Got %s' %
- (expected[2], expected[0], got[2]))
+ logging.error('Expected id %s for group %s). Got %s',
+ expected[2], expected[0], got[2])
if set(expected[3].split(',')) != set(got[3].split(',')):
failed = True
logging.error(
- 'Expected members %s for group %s. Got %s' % (
- expected[3], expected[0], got[3]))
+ 'Expected members %s for group %s. Got %s',
+ expected[3], expected[0], got[3])
for actual in group_actual:
got = [x for x in group_baseline if x[0] == actual[0]]
if not got:
failed = True
- logging.error('Unexpected group entry for %s' % actual[0])
+ logging.error('Unexpected group entry for %s', actual[0])
# Fail the test after all mismatches have been reported.
if failed: