coolify/resources/views/livewire/security/cloud-init-script-form.blade.php
Andras Bacsai d93a13eeee feat: add YAML validation for cloud-init scripts
Add ValidCloudInitYaml validation rule to ensure cloud-init scripts
are properly formatted before saving. The validator supports:
- Cloud-config YAML (with or without #cloud-config header)
- Bash scripts (starting with #!)
- Empty/null values (optional field)

Uses Symfony YAML parser to validate YAML syntax and provides
detailed error messages when validation fails.

Added comprehensive unit tests covering:
- Valid cloud-config with/without header
- Valid bash scripts
- Invalid YAML syntax detection
- Complex multi-section cloud-config

Applied validation to:
- ByHetzner component (server creation)
- CloudInitScriptForm component (script management)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-11 13:56:55 +02:00

17 lines
713 B
PHP

<form wire:submit='save' class="flex flex-col gap-4 w-full">
<x-forms.input id="name" label="Script Name" helper="A descriptive name for this cloud-init script." required />
<x-forms.textarea id="script" label="Script Content" rows="12"
helper="Enter your cloud-init script. Supports cloud-config YAML format." required />
<div class="flex justify-end gap-2">
@if ($modal_mode)
<x-forms.button type="button" @click="$dispatch('closeModal')">
Cancel
</x-forms.button>
@endif
<x-forms.button type="submit" isHighlighted>
{{ $scriptId ? 'Update Script' : 'Create Script' }}
</x-forms.button>
</div>
</form>