From d68951ac245150eeefa6e0f4156e4c1b5c9e9325 Mon Sep 17 00:00:00 2001 From: Jan Gelety Date: Tue, 12 Nov 2019 05:27:43 +0100 Subject: Python3: resources and libraries Change-Id: I1392c06b1d64f62b141d24c0d42a8e36913b15e2 Signed-off-by: Jan Gelety --- resources/libraries/python/LimitUtil.py | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) (limited to 'resources/libraries/python/LimitUtil.py') diff --git a/resources/libraries/python/LimitUtil.py b/resources/libraries/python/LimitUtil.py index 45aeaff5a0..c34109c2b7 100644 --- a/resources/libraries/python/LimitUtil.py +++ b/resources/libraries/python/LimitUtil.py @@ -15,10 +15,10 @@ from resources.libraries.python.ssh import exec_cmd_no_error -__all__ = ["LimitUtil"] +__all__ = [u"LimitUtil"] -class LimitUtil(object): +class LimitUtil: """Class contains methods for getting or setting process resource limits.""" @staticmethod @@ -30,10 +30,8 @@ class LimitUtil(object): :type node: dict :type pid: int """ - command = 'prlimit --noheadings --pid={pid}'.format(pid=pid) - - message = 'Node {host} failed to run: {command}'.\ - format(host=node['host'], command=command) + command = f"prlimit --noheadings --pid={pid}" + message = f"Node {node[u'host']} failed to run: {command}" exec_cmd_no_error(node, command, sudo=True, message=message) @@ -50,11 +48,7 @@ class LimitUtil(object): :type resource: str :type limit: str """ - command = 'prlimit --{resource}={limit} --pid={pid}'.format( - resource=resource, limit=limit, pid=pid) - - message = 'Node {host} failed to run: {command}'.\ - format(host=node['host'], command=command) + command = f"prlimit --{resource}={limit} --pid={pid}" + message = f"Node {node[u'host']} failed to run: {command}" exec_cmd_no_error(node, command, sudo=True, message=message) - -- cgit 1.2.3-korg