ajoute la liaison Laravel-OpenStack et le modèle Heat du lab 08
Un gabarit Heat généré depuis chaque lab.yaml, une stack par session de lab (création à l'admission, suppression à l'expiration via des jobs Redis et un worker systemd dédié). Passage du compte de service à une authentification par mot de passe : Heat refuse de créer un trust à partir d'un jeton d'application credential (voir ADR 0002). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
8742bde807
commit
67a754f733
34 changed files with 1095 additions and 91 deletions
51
portail/app/Services/Labs/DefinitionLab.php
Normal file
51
portail/app/Services/Labs/DefinitionLab.php
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
<?php
|
||||
|
||||
namespace App\Services\Labs;
|
||||
|
||||
use Illuminate\Support\Facades\File;
|
||||
use RuntimeException;
|
||||
use Symfony\Component\Yaml\Yaml;
|
||||
|
||||
/**
|
||||
* Lit le lab.yaml d'un lab (voir paillasse-contenus/README.md pour le
|
||||
* format), pour que GenerateurTemplateHeat puisse en faire une stack.
|
||||
*/
|
||||
class DefinitionLab
|
||||
{
|
||||
public readonly string $identifiant;
|
||||
|
||||
/** @var array<int, array{nom: string, cidr: string}> */
|
||||
public readonly array $reseaux;
|
||||
|
||||
/** @var array<int, array{nom: string, image: string, flavor: string, reseaux: array<int, string>, preparation: ?string}> */
|
||||
public readonly array $machines;
|
||||
|
||||
public static function depuis(string $identifiantLab): self
|
||||
{
|
||||
$chemin = config('labs.dossier')."/{$identifiantLab}/lab.yaml";
|
||||
|
||||
if (! File::exists($chemin)) {
|
||||
throw new RuntimeException("Lab introuvable : {$chemin}");
|
||||
}
|
||||
|
||||
$donnees = Yaml::parseFile($chemin);
|
||||
|
||||
return new self($donnees);
|
||||
}
|
||||
|
||||
private function __construct(array $donnees)
|
||||
{
|
||||
$this->identifiant = $donnees['id'];
|
||||
$this->reseaux = $donnees['reseaux'];
|
||||
$this->machines = array_map(
|
||||
fn (array $m) => [
|
||||
'nom' => $m['nom'],
|
||||
'image' => $m['image'],
|
||||
'flavor' => $m['flavor'],
|
||||
'reseaux' => $m['reseaux'],
|
||||
'preparation' => $m['preparation'] ?? null,
|
||||
],
|
||||
$donnees['machines'],
|
||||
);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue