Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix deploy.tags [422] error #8

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions pelican/pelican.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,11 @@ function pelican_ConfigOptions() {
"Type" => "text",
"Size" => 10,
],
"location_id" => [
"FriendlyName" => "Location ID",
"Description" => "ID of the Location to automatically deploy to. (deprecated)",
"tags" => [
"FriendlyName" => "Primary Tags",
"Description" => "Primary Tags Of The Nodes",
"Type" => "text",
"Size" => 10,
"Size" => 25,
],
"dedicated_ip" => [
"FriendlyName" => "Dedicated IP",
Expand Down Expand Up @@ -320,7 +320,9 @@ function pelican_CreateAccount(array $params) {
} else {
throw new Exception('Failed to create user, received error code: ' . $userResult['status_code'] . '. Enable module debug log for more info.');
}

// NekoMonci12 - Start
$tags = pelican_GetOption($params, 'tags');
// NekoMonci12 - End
$eggId = pelican_GetOption($params, 'egg_id');

$eggData = pelican_API($params, 'eggs/' . $eggId . '?include=variables');
Expand All @@ -345,7 +347,7 @@ function pelican_CreateAccount(array $params) {
$io = pelican_GetOption($params, 'io');
$cpu = pelican_GetOption($params, 'cpu');
$disk = pelican_GetOption($params, 'disk');
$location_id = pelican_GetOption($params, 'location_id');
$tags = pelican_GetOption($params, 'tags');
$dedicated_ip = pelican_GetOption($params, 'dedicated_ip') ? true : false;
$port_range = pelican_GetOption($params, 'port_range');
$port_range = isset($port_range) ? explode(',', $port_range) : [];
Expand All @@ -361,7 +363,9 @@ function pelican_CreateAccount(array $params) {
'egg' => (int) $eggId,
'docker_image' => $image,
'startup' => $startup,
'oom_killer' => $oom_killer,
// NekoMonci12 - Start
'oom_disabled' => $oom_killer, // The oom_killer is still called as oom_disabled in API
// NekoMonci12 - End
'limits' => [
'memory' => (int) $memory,
'swap' => (int) $swap,
Expand All @@ -375,7 +379,10 @@ function pelican_CreateAccount(array $params) {
'backups' => (int) $backups,
],
'deploy' => [
'locations' => [(int) $location_id],
// NekoMonci12 - Start
'locations' => [], // locations is still needed in the API, but it's not used
'tags' => is_array($tags) ? $tags : [$tags], // tags still cant make node filters (currently used to allow the node creation only)
// NekoMonci12 - End
'dedicated_ip' => $dedicated_ip,
'port_range' => $port_range,
],
Expand Down