@OrFail("Upgrading cluster")
  def UpgradeCluster(self):
    assert isinstance(self.config_data, dict)
    # pylint can't infer config_data type
    # pylint: disable=E1103
    cluster = self.config_data.get("cluster", None)
    if cluster is None:
      raise Error("Cannot find cluster")

    ipolicy = cluster.setdefault("ipolicy", None)
    if ipolicy:
      self.UpgradeIPolicy(ipolicy, constants.IPOLICY_DEFAULTS, False)
    ial_params = cluster.get("default_iallocator_params", None)

    if not ial_params:
      cluster["default_iallocator_params"] = {}

    if not "candidate_certs" in cluster:
      cluster["candidate_certs"] = {}

    cluster["instance_communication_network"] = \
      cluster.get("instance_communication_network", "")

    cluster["install_image"] = \
      cluster.get("install_image", "")

    cluster["zeroing_image"] = \
      cluster.get("zeroing_image", "")

    cluster["compression_tools"] = \
      cluster.get("compression_tools", constants.IEC_DEFAULT_TOOLS)

    if "enabled_user_shutdown" not in cluster:
      cluster["enabled_user_shutdown"] = False

    cluster["data_collectors"] = cluster.get("data_collectors", {})
    for name in constants.DATA_COLLECTOR_NAMES:
      cluster["data_collectors"][name] = \
        cluster["data_collectors"].get(
            name, dict(active=True,
                       interval=constants.MOND_TIME_INTERVAL * 1e6))
    if "diagnose_data_collector_filename" not in cluster:
      cluster["diagnose_data_collector_filename"] = ""

    # These parameters are set to pre-2.16 default values, which
    # differ from post-2.16 default values
    if cluster not in "ssh_key_type":
      cluster["ssh_key_type"] = constants.SSHK_DSA

    if "ssh_key_bits" not in cluster:
      cluster["ssh_key_bits"] = 1024
dataset/ETHPy150Open ganeti/ganeti/lib/tools/cfgupgrade.py/CfgUpgrade.UpgradeCluster/swapped operands of `not in`