feat: manage OS images in database instead of hardcoded values
- Add os_images table with linode_image_id and vultr_os_id columns - Support Ubuntu (24.04, 22.04), Debian (11-13), AlmaLinux (8-9), Rocky Linux (8-9), and Fedora 42 - AlmaLinux and Rocky Linux added as CentOS migration alternatives - Default OS changed from ubuntu_22_04 to ubuntu_24_04 - Fix Vultr OS IDs (1743=22.04, 2284=24.04) - Remove hardcoded OS validation, validate against DB - Return available OS list in error message for invalid image Migration: migrations/003_os_images.sql Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -47,9 +47,13 @@ function validateProvisionRequest(body: unknown): {
|
||||
return { valid: false, error: 'label must be 64 characters or less' };
|
||||
}
|
||||
|
||||
const validOsImages = ['ubuntu_22_04', 'ubuntu_20_04', 'debian_11', 'debian_12'];
|
||||
if (data.image !== undefined && !validOsImages.includes(data.image as string)) {
|
||||
return { valid: false, error: `image must be one of: ${validOsImages.join(', ')}` };
|
||||
// Basic type validation for image - actual validation against DB done in ProvisioningService
|
||||
if (data.image !== undefined && typeof data.image !== 'string') {
|
||||
return { valid: false, error: 'image must be a string' };
|
||||
}
|
||||
|
||||
if (data.image && (data.image as string).length > 50) {
|
||||
return { valid: false, error: 'image key must be 50 characters or less' };
|
||||
}
|
||||
|
||||
if (data.dry_run !== undefined && typeof data.dry_run !== 'boolean') {
|
||||
|
||||
Reference in New Issue
Block a user