我正在遵循已编写的其他一些代码的示例。有问题的代码如下所示:
if virtualname == "ebs":
if deviceSize == None:
deviceSize = 8
if delOnTerminate == None or delOnTerminate == "true":
DOT = "true"
else:
DOT = "false"
lc.BlockDeviceMappings.append(ec2.EBSBlockDeviceMapping(
DeviceName=blockname,
Ebs=ec2.EBSBlockDevice(VolumeSize=deviceSize,
DeleteOnTermination=DOT)))
else:
lc.BlockDeviceMappings.append(ec2.BlockDeviceMapping(DeviceName=blockname,
VirtualName=virtualname))