Exemple #1
0
    def _validate_block_device_mapping(device_mapping):

        from botocore import __version__ as botocore_version

        if "no_device" in device_mapping:
            assert isinstance(
                device_mapping["no_device"], str
            ), "botocore {} isn't limiting NoDevice to str type anymore, it is type:{}".format(
                botocore_version, type(device_mapping["no_device"])
            )
            if device_mapping["no_device"] == "":
                # the only legit value it can have is empty string
                # and none of the other checks here matter if NoDevice
                # is being used
                return
            else:
                raise InvalidRequest()

        if not any(mapping for mapping in device_mapping if mapping.startswith("ebs.")):
            raise MissingParameterError("ebs")
        if (
            "ebs._volume_size" not in device_mapping
            and "ebs._snapshot_id" not in device_mapping
        ):
            raise MissingParameterError("size or snapshotId")
Exemple #2
0
    def _validate_block_device_mapping(device_mapping):

        if not any(mapping for mapping in device_mapping
                   if mapping.startswith("ebs.")):
            raise MissingParameterError("ebs")
        if ("ebs._volume_size" not in device_mapping
                and "ebs._snapshot_id" not in device_mapping):
            raise MissingParameterError("size or snapshotId")