You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
998 B
PHP
31 lines
998 B
PHP
<?php
|
|
|
|
$source = file_get_contents(
|
|
dirname(__DIR__) . '/app/Controllers/CloudApiController.php'
|
|
);
|
|
if ($source === false) {
|
|
throw new RuntimeException('Unable to read CloudApiController source');
|
|
}
|
|
|
|
$service = 'CloudRescueCatalogService';
|
|
$import = 'use App\\Services\\Cloud\\' . $service . ';';
|
|
if (!str_contains($source, $import)) {
|
|
throw new RuntimeException(
|
|
'The VM-scoped resources endpoint must import ' . $service
|
|
);
|
|
}
|
|
|
|
$resourcesStart = strpos($source, 'public function resources(');
|
|
$resourcesEnd = strpos($source, 'public function userIsos(', $resourcesStart);
|
|
if ($resourcesStart === false || $resourcesEnd === false
|
|
|| !str_contains(
|
|
substr($source, $resourcesStart, $resourcesEnd - $resourcesStart),
|
|
$service . '::publicCatalogForHost($hostId)'
|
|
)) {
|
|
throw new RuntimeException(
|
|
'The VM-scoped resources endpoint must load exact global replicas'
|
|
);
|
|
}
|
|
|
|
echo "VM-scoped rescue resources resolve their catalog service.\n";
|