fix(striker-ui-api): pass Remote->test_access() user to Cluster->get_primary_host_uuid()

main
Tsu-ba-me 3 years ago
parent c074f548ed
commit c413e62798
  1. 3
      Anvil/Tools/Cluster.pm
  2. 31
      striker-ui-api/src/lib/request_handlers/server/createServer.ts

@ -2153,6 +2153,7 @@ sub get_primary_host_uuid
my $self = shift;
my $parameter = shift;
my $anvil = $self->parent;
my $test_access_user = defined $parameter->{test_access_user} ? $parameter->{test_access_user} : undef;
my $debug = defined $parameter->{debug} ? $parameter->{debug} : 3;
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => $debug, key => "log_0125", variables => { method => "Cluster->get_primary_host_uuid()" }});
@ -2201,11 +2202,13 @@ sub get_primary_host_uuid
debug => $debug,
target => $node1_target_ip,
password => $password,
user => $test_access_user,
});
my $node2_access = $anvil->Remote->test_access({
debug => $debug,
target => $node2_target_ip,
password => $password,
user => $test_access_user,
});
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
node1_access => $node1_access,

@ -2,7 +2,7 @@ import { RequestHandler } from 'express';
// import SERVER_PATHS from '../../consts/SERVER_PATHS';
import { sub } from '../../accessModule';
import { dbQuery, sub } from '../../accessModule';
export const createServer: RequestHandler = ({ body }, response) => {
console.log('Creating server.');
@ -19,6 +19,8 @@ export const createServer: RequestHandler = ({ body }, response) => {
optimizeForOS,
} = body;
console.dir(body, { depth: null });
const provisionServerJobData = `
server_name=${serverName}
os=${optimizeForOS}
@ -29,17 +31,32 @@ storage_size=${storageSize}
install_iso=${installISOFileUUID}
driver_iso=${driverISOFileUUIDs}`;
console.log(`provisionServerJobData: ${provisionServerJobData}`);
console.log(`provisionServerJobData: [${provisionServerJobData}]`);
let provisionServerJobHostUUID: string;
const { stdout: provisionServerJobHostUUID } = sub(
'get_primary_host_uuid',
{
({ stdout: provisionServerJobHostUUID } = sub('get_primary_host_uuid', {
subModuleName: 'Cluster',
subParams: { anvil_uuid: anvilUUID },
subParams: {
anvil_uuid: anvilUUID,
test_access_user: 'admin',
},
}));
console.log(
`provisionServerJobHostUUID from Cluster->get_primary_host_uuid(): [${provisionServerJobHostUUID}]`,
);
console.log(`provisionServerJobHostUUID: [${provisionServerJobHostUUID}]`);
if (provisionServerJobHostUUID === '') {
[[provisionServerJobHostUUID]] = dbQuery(`
SELECT anvil_node1_host_uuid
FROM anvils
WHERE anvil_uuid = '${anvilUUID}'`).stdout;
}
console.log(
`provisionServerJobHostUUID from DB: [${provisionServerJobHostUUID}]`,
);
// sub('insert_or_update_jobs', {
// subParams: {

Loading…
Cancel
Save