diff options
author | Cédric Ollivier <cedric.ollivier@orange.com> | 2021-11-15 15:13:46 +0100 |
---|---|---|
committer | Cédric Ollivier <cedric.ollivier@orange.com> | 2021-11-15 15:14:11 +0100 |
commit | e3c09959d8639b6e798759bb74e98a752b98b7f4 (patch) | |
tree | 587a31b2b9f88b2935ffb26ebdbd1f1511d329f0 /functest_kubernetes/security | |
parent | b100b1254e06719bf1c779b9d53d0ac2da67fca4 (diff) |
Update linters and fix all new issues
It mostly adds encoding in open calls and leverages f-strings.
It removes ansible-lint as it now asks for ansible, roles and collections.
Change-Id: I3ef729f44b2c721b14d19df27805938298aa2c67
Signed-off-by: Cédric Ollivier <cedric.ollivier@orange.com>
Diffstat (limited to 'functest_kubernetes/security')
-rw-r--r-- | functest_kubernetes/security/security.py | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/functest_kubernetes/security/security.py b/functest_kubernetes/security/security.py index 3d36679f..751fd29b 100644 --- a/functest_kubernetes/security/security.py +++ b/functest_kubernetes/security/security.py @@ -66,7 +66,7 @@ class SecurityTesting(testcase.TestCase): self.__logger.debug("create_namespace: %s", api_response) with open(pkg_resources.resource_filename( "functest_kubernetes", - "security/{}.yaml".format(self.job_name)), + f"security/{self.job_name}.yaml"), encoding='utf-8') as yfile: template = Template(yfile.read()) body = yaml.safe_load(template.render( @@ -87,7 +87,7 @@ class SecurityTesting(testcase.TestCase): time.time()-self.start_time) watch_job.stop() pods = self.corev1.list_namespaced_pod( - self.namespace, label_selector='job-name={}'.format(self.job_name)) + self.namespace, label_selector=f'job-name={self.job_name}') self.pod = pods.items[0].metadata.name self.pod_log = self.corev1.read_namespaced_pod_log( name=self.pod, namespace=self.namespace) @@ -207,7 +207,7 @@ class KubeBench(SecurityTesting): self.ns_generate_name = "kube-bench-" def run(self, **kwargs): - self.job_name = "kube-bench-{}".format(kwargs.get("target", "node")) + self.job_name = f'kube-bench-{kwargs.get("target", "node")}' super().run(**kwargs) self.details["report"] = ast.literal_eval(self.pod_log) msg = prettytable.PrettyTable( |