1
0
Fork 0
mirror of https://github.com/ansible-collections/hetzner.hcloud.git synced 2026-02-04 08:01:49 +00:00

refactor: use f-strings (#310)

##### SUMMARY

Replace string interpolation with f-strings. Improves readability, and
should help prevent #309
This commit is contained in:
Jonas L 2023-08-24 11:27:40 +02:00 committed by GitHub
parent deee06281e
commit c56cbab1a0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 43 additions and 36 deletions

View file

@ -174,13 +174,13 @@ class AnsibleHCloudLoadBalancerTarget(AnsibleHCloud):
load_balancer_name = self.module.params.get("load_balancer")
self.hcloud_load_balancer = self.client.load_balancers.get_by_name(load_balancer_name)
if not self.hcloud_load_balancer:
self.module.fail_json(msg="Load balancer does not exist: %s" % load_balancer_name)
self.module.fail_json(msg=f"Load balancer does not exist: {load_balancer_name}")
if self.module.params.get("type") == "server":
server_name = self.module.params.get("server")
self.hcloud_server = self.client.servers.get_by_name(server_name)
if not self.hcloud_server:
self.module.fail_json(msg="Server not found: %s" % server_name)
self.module.fail_json(msg=f"Server not found: {server_name}")
self.hcloud_load_balancer_target = None
except HCloudException as e:
@ -290,7 +290,7 @@ class AnsibleHCloudLoadBalancerTarget(AnsibleHCloud):
"choices": ["absent", "present"],
"default": "present",
},
**super().base_module_arguments()
**super().base_module_arguments(),
),
supports_check_mode=True,
)