-# 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:
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
: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)
: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)
-