Skip to content

Commit cd22908

Browse files
Tim SmithTimSmithCtx
authored andcommitted
Modernise log formatting in mpathcount
This also addresses a logging issue in the error path which has been present since 2018 or so. Signed-off-by: Tim Smith <tim.smith@cloud.com>
1 parent 1d5aa2c commit cd22908

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

utils/mpathcount

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ if __name__ == '__main__':
6161
mpathcount.mpc_exit(session, -1)
6262

6363
try:
64-
pbds = session.xenapi.PBD.get_all_records_where("field \"host\" = \"%s\"" % localhost)
64+
pbds = session.xenapi.PBD.get_all_records_where(f'field "host" = "{localhost}"')
6565
except:
6666
mpathcount.mpc_exit(session, -1)
6767

@@ -86,7 +86,7 @@ if __name__ == '__main__':
8686
util.atomicFileWrite(mpathcount.MPATH_FILE_NAME, mpathcount.MPATHS_DIR, json.dumps(mpath_status))
8787
os.chmod(mpathcount.MPATH_FILE_NAME, 0o0644)
8888
except:
89-
util.SMlog("MPATH: Failure updating db. %s" % sys.exc_info())
89+
util.SMlog(f'MPATH: Failure updating db. {sys.exc_info()}')
9090
mpathcount.mpc_exit(session, -1)
9191

9292
util.SMlog("MPATH: Update done")

0 commit comments

Comments
 (0)