aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python/SysctlUtil.py
diff options
context:
space:
mode:
authorJan Gelety <jgelety@cisco.com>2019-11-12 05:27:43 +0100
committerJan Gelety <jgelety@cisco.com>2019-11-28 18:26:21 +0100
commitd68951ac245150eeefa6e0f4156e4c1b5c9e9325 (patch)
tree487554a7547218d27f0a61ec02b70502c32cdcb4 /resources/libraries/python/SysctlUtil.py
parented0258a440cfad7023d643f717ab78ac568dc59b (diff)
Python3: resources and libraries
Change-Id: I1392c06b1d64f62b141d24c0d42a8e36913b15e2 Signed-off-by: Jan Gelety <jgelety@cisco.com>
Diffstat (limited to 'resources/libraries/python/SysctlUtil.py')
-rw-r--r--resources/libraries/python/SysctlUtil.py17
1 files changed, 6 insertions, 11 deletions
diff --git a/resources/libraries/python/SysctlUtil.py b/resources/libraries/python/SysctlUtil.py
index 0db7e2c5e5..f8c169a833 100644
--- a/resources/libraries/python/SysctlUtil.py
+++ b/resources/libraries/python/SysctlUtil.py
@@ -15,10 +15,10 @@
from resources.libraries.python.ssh import exec_cmd_no_error
-__all__ = ["SysctlUtil"]
+__all__ = [u"SysctlUtil"]
-class SysctlUtil(object):
+class SysctlUtil:
"""Class contains methods for getting or setting sysctl settings."""
@staticmethod
@@ -30,10 +30,8 @@ class SysctlUtil(object):
:type node: dict
:type key: str
"""
- command = 'sysctl {key}'.format(key=key)
-
- message = 'Node {host} failed to run: {command}'.\
- format(host=node['host'], command=command)
+ command = f"sysctl {key}"
+ message = f"Node {node[u'host']} failed to run: {command}"
exec_cmd_no_error(node, command, sudo=True, message=message)
@@ -48,10 +46,7 @@ class SysctlUtil(object):
:type key: str
:type value: str
"""
- command = 'sysctl -w {key}={value}'.format(key=key, value=value)
-
- message = 'Node {host} failed to run: {command}'.\
- format(host=node['host'], command=command)
+ command = f"sysctl -w {key}={value}"
+ message = f"Node {node[u'host']} failed to run: {command}"
exec_cmd_no_error(node, command, sudo=True, message=message)
-