def post_load_process()

in backend/bms_app/inventory_manager/schema.py [0:0]


    def post_load_process(self, data, **kwargs):
        if not data.get('machine_type'):
            if not all((x in data for x in ('cpu', 'socket', 'ram'))):
                raise ValidationError(
                    {'cpu/socket/ram': ['Please specify all fields or fill in machineType field.']}
                )

        if not any(network['type'] == 'CLIENT' for network in data['networks']):
            raise ValidationError(
                {'networks': ["Please specify at least one type network as 'CLIENT'."]}
            )

        all_volumes = [lun['storage_volume'] for lun in data['luns']]
        if len(all_volumes) != len(set(all_volumes)):
            raise ValidationError(
                {'storage_volume': ["Please specify unique storage_volume value"]}
            )

        return data