HomeClusterLabs Projects

Refactor: cts: Drop Corosync2.__init__()

Description

Refactor: cts: Drop Corosync2.init()

We can get rid of self._components by building it each time in the
components() method.

  1. We don't need a dict because we never access the values by key. We only need the list of Process instances.
  2. Technically something could modify the Corosync2 instance's components list if we return the list itself. Ideally it would be treated as constant after creation.
  3. If components() returns a copy, then by default it's a shallow copy, and we run into the same issue with the Process instances within the list.
  4. We could turn the Process members into properties, but that feels like overkill. Since performance isn't an concern here, we can just build and return the list each time in the Corosync2.components() method.

Signed-off-by: Reid Wahl <nrwahl@protonmail.com>

Details

Provenance
nrwahl2Authored on Wed, Aug 20, 5:21 PM
Parents
rP9c3b742f317e: Refactor: cts: Use some comprehensions in audits
Branches
Unknown
Tags
Unknown