Skip to content

Commit 3e6b4a5

Browse files
improved readability. Ignored pylint multiple branches for volume creation
1 parent c91e3d4 commit 3e6b4a5

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

bibigrid/core/actions/create.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ def start_worker(self, worker, worker_count, configuration, provider): # pylint
280280
self.host_vars["host_entries"][name] = server["private_v4"]
281281
self.log.debug(f"Added worker {name} to host vars.")
282282

283-
# pylint: disable=duplicate-code
283+
# pylint: disable=too-many-branches
284284
def create_server_volumes(self, provider, instance, name):
285285
"""
286286
Creates all volumes of a single instance
@@ -298,7 +298,9 @@ def create_server_volumes(self, provider, instance, name):
298298

299299
for i, volume in enumerate(instance.get("volumes", [])):
300300
self.log.debug(f"Volume {i}: {volume}")
301-
if not volume.get("exists"):
301+
if volume.get("exists"):
302+
volume_name = volume.get("name")
303+
else:
302304
if volume.get("permanent"):
303305
infix = "perm"
304306
elif volume.get("semiPermanent"):
@@ -307,8 +309,6 @@ def create_server_volumes(self, provider, instance, name):
307309
infix = "tmp"
308310
postfix = f"-{volume.get('name')}" if volume.get('name') else ''
309311
volume_name = f"{name}-{infix}-{i}{postfix}"
310-
else:
311-
volume_name = volume.get("name")
312312
volume_name_or_id = volume.get("id", volume_name)
313313
self.log.debug(f"Checking if volume {volume_name_or_id} exists")
314314
return_volume = provider.get_volume_by_id_or_name(volume_name_or_id)

0 commit comments

Comments
 (0)