Skip to content

Commit

Permalink
fix: server description and tailscale timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
NichArchA82 committed Dec 6, 2024
1 parent 3f216f4 commit 50f28b7
Showing 1 changed file with 5 additions and 7 deletions.
12 changes: 5 additions & 7 deletions command-handler/src/util/libvirt/libvirt-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export default {
"vm_name": serverName,
"tags": {
"owner": {
"name": userEmail
"name": `"${userEmail}"`
}
},
"user_data": Buffer.from(configUserData(serverName)).toString('base64'),
Expand Down Expand Up @@ -93,10 +93,10 @@ export default {

let attempts;

let maxRetries = 1;
let maxRetries = 13;
for (attempts = 1; attempts <= maxRetries; attempts++) {
//wait 30 seconds
await delay(1000 * 30);
//wait 10 seconds
await delay(1000 * 10);
try {
//get servers and info from tailscale
const { deviceId } = await getDevices(serverName);
Expand Down Expand Up @@ -208,9 +208,7 @@ export default {

for (const server of data) {
// Update the regex to wrap both keys and values in double quotes
const description = JSON.parse(server.description
.replace(/([{,])\s*(\w+)\s*:/g, '$1"$2":') // Add quotes to keys
.replace(/:\s*(\w+)(?=\s*[\},])/g, ':"$1"')); // Add quotes to values
const description = JSON.parse(server.description);

const owner = description.owner.name;

Expand Down

0 comments on commit 50f28b7

Please sign in to comment.