]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/cephadm: Do not use variables named 'I', 'O', or 'l' (E741)
authorMichael Fritch <mfritch@suse.com>
Thu, 28 Jan 2021 20:05:56 +0000 (13:05 -0700)
committerSebastian Wagner <sebastian.wagner@suse.com>
Tue, 23 Feb 2021 09:58:23 +0000 (10:58 +0100)
Signed-off-by: Michael Fritch <mfritch@suse.com>
(cherry picked from commit fb73d8e5c21c6ff448d1cc28b7c4900456022b82)

src/pybind/mgr/cephadm/module.py
src/pybind/mgr/cephadm/schedule.py
src/pybind/mgr/orchestrator/module.py
src/pybind/mgr/tox.ini

index cebb09a5ed7c48178be0a695d7d2a5e036bad725..8d4d86b89bece8a55caa644a5c3882c318166b3a 100644 (file)
@@ -637,10 +637,10 @@ class CephadmOrchestrator(orchestrator.Orchestrator, MgrModule,
         if ssh_config is None or len(ssh_config.strip()) == 0:
             raise OrchestratorValidationError('ssh_config cannot be empty')
         # StrictHostKeyChecking is [yes|no] ?
-        l = re.findall(r'StrictHostKeyChecking\s+.*', ssh_config)
-        if not l:
+        res = re.findall(r'StrictHostKeyChecking\s+.*', ssh_config)
+        if not res:
             raise OrchestratorValidationError('ssh_config requires StrictHostKeyChecking')
-        for s in l:
+        for s in res:
             if 'ask' in s.lower():
                 raise OrchestratorValidationError(f'ssh_config cannot contain: \'{s}\'')
 
index 8ad2bae4fa1fc0d498d13bd49934d3a7122df25f..7913c35e6788b957d4243e5116233c15f327ad84 100644 (file)
@@ -272,23 +272,23 @@ class HostAssignment(object):
         return existing
 
 
-def merge_hostspecs(l: List[HostPlacementSpec], r: List[HostPlacementSpec]) -> Iterable[HostPlacementSpec]:
+def merge_hostspecs(lh: List[HostPlacementSpec], rh: List[HostPlacementSpec]) -> Iterable[HostPlacementSpec]:
     """
-    Merge two lists of HostPlacementSpec by hostname. always returns `l` first.
+    Merge two lists of HostPlacementSpec by hostname. always returns `lh` first.
 
     >>> list(merge_hostspecs([HostPlacementSpec(hostname='h', name='x', network='')],
     ...                      [HostPlacementSpec(hostname='h', name='y', network='')]))
     [HostPlacementSpec(hostname='h', network='', name='x')]
 
     """
-    l_names = {h.hostname for h in l}
-    yield from l
-    yield from (h for h in r if h.hostname not in l_names)
+    lh_names = {h.hostname for h in lh}
+    yield from lh
+    yield from (h for h in rh if h.hostname not in lh_names)
 
 
-def difference_hostspecs(l: List[HostPlacementSpec], r: List[HostPlacementSpec]) -> List[HostPlacementSpec]:
+def difference_hostspecs(lh: List[HostPlacementSpec], rh: List[HostPlacementSpec]) -> List[HostPlacementSpec]:
     """
-    returns l "minus" r by hostname.
+    returns lh "minus" rh by hostname.
 
     >>> list(difference_hostspecs([HostPlacementSpec(hostname='h1', name='x', network=''),
     ...                           HostPlacementSpec(hostname='h2', name='y', network='')],
@@ -296,5 +296,5 @@ def difference_hostspecs(l: List[HostPlacementSpec], r: List[HostPlacementSpec])
     [HostPlacementSpec(hostname='h1', network='', name='x')]
 
     """
-    r_names = {h.hostname for h in r}
-    return [h for h in l if h.hostname not in r_names]
+    rh_names = {h.hostname for h in rh}
+    return [h for h in lh if h.hostname not in rh_names]
index 6b745076276cf6e82197b14a2a7fba2333ef7360..f244c57e02a46bed7ce5b1409ad11bbb599f098c 100644 (file)
@@ -240,7 +240,7 @@ class OrchestratorCli(OrchestratorClientMixin, MgrModule,
     def _get_device_locations(self, dev_id):
         # type: (str) -> List[DeviceLightLoc]
         locs = [d['location'] for d in self.get('devices')['devices'] if d['devid'] == dev_id]
-        return [DeviceLightLoc(**l) for l in sum(locs, [])]
+        return [DeviceLightLoc(**loc) for loc in sum(locs, [])]
 
     @_cli_read_command(prefix='device ls-lights')
     def _device_ls(self) -> HandleCommandResult:
index 3666dd6e0a67bae5f06bcdae0202138d97409e93..dd66314258c9ffc1015f5b01d7d50698b939a77f 100644 (file)
@@ -12,7 +12,6 @@ requires = cython
 max-line-length = 100
 ignore =
     E501,
-    E741,
     F401,
     F541,
     F632,