]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
cephadm: rename argument to container from c
authorJohn Mulligan <jmulligan@redhat.com>
Tue, 6 Jun 2023 20:17:57 +0000 (16:17 -0400)
committerJohn Mulligan <jmulligan@redhat.com>
Wed, 9 Aug 2023 17:48:07 +0000 (13:48 -0400)
Rename argument to "container" from "c" because a one character
variable at a large function's scope (or anywhere outside of a
comprehension) is a understanding/readability issue (IMO).

Signed-off-by: John Mulligan <jmulligan@redhat.com>
src/cephadm/cephadm.py

index eaa52d3ff951fc91490f51fde2d83fa5bcaa32ce..36530f0a560f1ee8d080f2837c3583c4adc9d516 100755 (executable)
@@ -3822,7 +3822,7 @@ def deploy_daemon_units(
     gid: int,
     daemon_type: str,
     daemon_id: Union[int, str],
-    c: 'CephContainer',
+    container: 'CephContainer',
     enable: bool = True,
     start: bool = True,
     osd_fsid: Optional[str] = None,
@@ -3835,8 +3835,8 @@ def deploy_daemon_units(
         # before stopping it. Exit code will be success either if it doesn't
         # exist or if it exists and is stopped successfully.
         container_exists = f'{ctx.container_engine.path} inspect %s &>/dev/null'
-        f.write(f'! {container_exists % c.old_cname} || {" ".join(c.stop_cmd(old_cname=True, timeout=timeout))} \n')
-        f.write(f'! {container_exists % c.cname} || {" ".join(c.stop_cmd(timeout=timeout))} \n')
+        f.write(f'! {container_exists % container.old_cname} || {" ".join(container.stop_cmd(old_cname=True, timeout=timeout))} \n')
+        f.write(f'! {container_exists % container.cname} || {" ".join(container.stop_cmd(timeout=timeout))} \n')
 
     data_dir = get_data_dir(fsid, ctx.data_dir, daemon_type, daemon_id)
     run_file_path = data_dir + '/unit.run'
@@ -3903,7 +3903,7 @@ def deploy_daemon_units(
             tcmu_container = ceph_iscsi.get_tcmu_runner_container()
             _write_container_cmd_to_bash(ctx, f, tcmu_container, 'iscsi tcmu-runner container', background=True)
 
-        _write_container_cmd_to_bash(ctx, f, c, '%s.%s' % (daemon_type, str(daemon_id)))
+        _write_container_cmd_to_bash(ctx, f, container, '%s.%s' % (daemon_type, str(daemon_id)))
 
         # some metadata about the deploy
         meta: Dict[str, Any] = fetch_meta(ctx)
@@ -3949,9 +3949,9 @@ def deploy_daemon_units(
     with write_new(data_dir + '/unit.stop') as f:
         add_stop_actions(cast(TextIO, f), timeout)
 
-    if c:
+    if container:
         with write_new(data_dir + '/unit.image') as f:
-            f.write(c.image + '\n')
+            f.write(container.image + '\n')
 
     # sysctl
     install_sysctl(ctx, fsid, daemon_type)