Skip to content
Snippets Groups Projects
Unverified Commit 052e92ea authored by Rhys Arkins's avatar Rhys Arkins Committed by GitHub
Browse files

fix(terraform): externalhosterror for 503 (#12760)

parent 65ed85a6
No related branches found
No related tags found
No related merge requests found
import { ExternalHostError } from '../../types/errors/external-host-error';
import { cache } from '../../util/cache/package/decorator';
import type { HttpError } from '../../util/http/types';
import { ensureTrailingSlash } from '../../util/url';
import { Datasource } from '../datasource';
import type { ServiceDiscoveryResult } from './types';
......@@ -26,4 +28,16 @@ export abstract class TerraformDatasource extends Datasource {
private static getDiscoveryUrl(registryUrl: string): string {
return `${ensureTrailingSlash(registryUrl)}.well-known/terraform.json`;
}
override handleSpecificErrors(err: HttpError): void {
const failureCodes = ['EAI_AGAIN'];
// istanbul ignore if
if (failureCodes.includes(err.code)) {
throw new ExternalHostError(err);
}
// istanbul ignore if
if (err.response?.statusCode === 503) {
throw new ExternalHostError(err);
}
}
}
import { logger } from '../../logger';
import { ExternalHostError } from '../../types/errors/external-host-error';
import { cache } from '../../util/cache/package/decorator';
import type { HttpError } from '../../util/http/types';
import { regEx } from '../../util/regex';
import * as hashicorpVersioning from '../../versioning/hashicorp';
import type { GetReleasesConfig, ReleaseResult } from '../types';
......@@ -83,14 +81,6 @@ export class TerraformModuleDatasource extends TerraformDatasource {
return dep;
}
override handleSpecificErrors(err: HttpError): void {
const failureCodes = ['EAI_AGAIN'];
// istanbul ignore if
if (failureCodes.includes(err.code)) {
throw new ExternalHostError(err);
}
}
private static getRegistryRepository(
lookupName: string,
registryUrl: string
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment