mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 05:27:48 +00:00
misc: improved error handling
This commit is contained in:
@@ -3394,32 +3394,40 @@ const syncSecretsRundeck = async ({
|
|||||||
logger.info("No existing rundeck secrets");
|
logger.info("No existing rundeck secrets");
|
||||||
}
|
}
|
||||||
|
|
||||||
for await (const [key, value] of Object.entries(secrets)) {
|
try {
|
||||||
if (existingRundeckSecrets.includes(key)) {
|
for await (const [key, value] of Object.entries(secrets)) {
|
||||||
await request.put(`${integration.url}/api/44/storage/${integration.path}/${key}`, value.value, {
|
if (existingRundeckSecrets.includes(key)) {
|
||||||
headers: {
|
await request.put(`${integration.url}/api/44/storage/${integration.path}/${key}`, value.value, {
|
||||||
"X-Rundeck-Auth-Token": accessToken,
|
headers: {
|
||||||
"Content-Type": "application/x-rundeck-data-password"
|
"X-Rundeck-Auth-Token": accessToken,
|
||||||
}
|
"Content-Type": "application/x-rundeck-data-password"
|
||||||
});
|
}
|
||||||
} else {
|
});
|
||||||
await request.post(`${integration.url}/api/44/storage/${integration.path}/${key}`, value.value, {
|
} else {
|
||||||
headers: {
|
await request.post(`${integration.url}/api/44/storage/${integration.path}/${key}`, value.value, {
|
||||||
"X-Rundeck-Auth-Token": accessToken,
|
headers: {
|
||||||
"Content-Type": "application/x-rundeck-data-password"
|
"X-Rundeck-Auth-Token": accessToken,
|
||||||
}
|
"Content-Type": "application/x-rundeck-data-password"
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
for await (const existingSecret of existingRundeckSecrets) {
|
for await (const existingSecret of existingRundeckSecrets) {
|
||||||
if (!(existingSecret in secrets)) {
|
if (!(existingSecret in secrets)) {
|
||||||
await request.delete(`${integration.url}/api/44/storage/${integration.path}/${existingSecret}`, {
|
await request.delete(`${integration.url}/api/44/storage/${integration.path}/${existingSecret}`, {
|
||||||
headers: {
|
headers: {
|
||||||
"X-Rundeck-Auth-Token": accessToken
|
"X-Rundeck-Auth-Token": accessToken
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
} catch (err: unknown) {
|
||||||
|
throw new Error(
|
||||||
|
`Ensure that the provided Rundeck URL is accessible by Infisical and that the linked API token has sufficient permissions.\n\n${
|
||||||
|
(err as Error).message
|
||||||
|
}`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user