X-Git-Url: https://gerrit.fd.io/r/gitweb?p=csit.git;a=blobdiff_plain;f=resources%2Flibraries%2Fpython%2FSysctlUtil.py;h=6c5e9e208149192bb00e56b64f460c741cfd4e73;hp=0db7e2c5e5f3791d81494b3d447018d0c5dab521;hb=b6606e7625e308a66bdfb9d5a9c065b58e429a99;hpb=390cb24b3945442fba9f84dc292b6a4138d4835e diff --git a/resources/libraries/python/SysctlUtil.py b/resources/libraries/python/SysctlUtil.py index 0db7e2c5e5..6c5e9e2081 100644 --- a/resources/libraries/python/SysctlUtil.py +++ b/resources/libraries/python/SysctlUtil.py @@ -1,4 +1,4 @@ -# Copyright (c) 2019 Cisco and/or its affiliates. +# Copyright (c) 2021 Cisco and/or its affiliates. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at: @@ -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) -