[Buildbot] #3646: wth 1382003: unreachable code?
Buildbot trac
trac at buildbot.net
Mon Nov 28 21:53:37 UTC 2016
#3646: wth 1382003: unreachable code?
-------------------+--------------------
Reporter: sa2ajj | Owner:
Type: defect | Status: new
Priority: major | Milestone: 0.9.+
Version: 0.9.1 | Resolution:
Keywords: |
-------------------+--------------------
Description changed by sa2ajj:
Old description:
> 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))
New description:
while reviewing Coverity findings, I found this code:
[https://github.com/buildbot/buildbot/blob/master/master/buildbot/worker/ec2.py#L293
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))
--
--
Ticket URL: <http://trac.buildbot.net/ticket/3646#comment:3>
Buildbot <http://buildbot.net/>
Buildbot: build/test automation
More information about the bugs
mailing list