Opened 4 years ago

Last modified 4 years ago

#3646 new defect

wth 1382003: unreachable code?

Reported by: sa2ajj Owned by:
Priority: major Milestone: 0.9.+
Version: 0.9.1 Keywords:
Cc:

Description (last modified by sa2ajj)

while reviewing Coverity findings, I found this code:

buildbot/worker/ec2.py:293:

    def _convert_deprecated_block_device_mapping(self, mapping_definitions):
        new_mapping_definitions = []
        for dev_name, dev_config in iteritems(mapping_definitions):
            new_dev_config = {}
            new_dev_config['DeviceName'] = dev_name
            if dev_config:
                new_dev_config['Ebs'] = {}
                new_dev_config['Ebs']['DeleteOnTermination'] = dev_config.get(
                    'delete_on_termination', True)
                new_dev_config['Ebs'][
                    'Encrypted'] = dev_config.get('encrypted')
                new_dev_config['Ebs']['Iops'] = dev_config.get('iops')
                new_dev_config['Ebs'][
                    'SnapshotId'] = dev_config.get('snapshot_id')
                new_dev_config['Ebs']['VolumeSize'] = dev_config.get('size')
                new_dev_config['Ebs'][
                    'VolumeType'] = dev_config.get('volume_type')
                new_dev_config['Ebs'] = self._remove_none_opts(
                    new_dev_config['Ebs'])
            new_mapping_definitions.append(new_dev_config)
        return new_mapping_definitions
        if not mapping_definitions:
            return None

        for mapping_definition in mapping_definitions:
            ebs = mapping_definition.get('Ebs')
            if ebs:
                ebs.setdefault('DeleteOnTermination', True)

        return mapping_definitions

what the heck is going on here?

(the number in the summary is CID (Coverity ID))

Change History (4)

comment:1 Changed 4 years ago by sa2ajj

  • Description modified (diff)
  • Summary changed from wth: unreachable code? to wth 1382003: unreachable code?

comment:2 Changed 4 years ago by sa2ajj

  • Description modified (diff)

comment:3 Changed 4 years ago by sa2ajj

  • Description modified (diff)
Note: See TracTickets for help on using tickets.