Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
let d = JSON.parse(msg["Values"]["data"]);
if (d["kind"] == "error") {
err = d["log"];
break;
}
// add only valid events
if (d["log"] != null && d["created_resources"] != null && d["total_resources"] != null) {
validEvents.push(d);
}
}
}
if (err) {
posthog.capture('Provisioning Error', {error: err});
let e = ansiparse(err).map((el: any) => {
return el.text;
})
let index = this.state.infras.findIndex(el => el.kind === infra.kind)
infra.status = "error"
let infras = this.state.infras
infras[index] = infra
this.setState({ logs: [...this.state.logs, ...e], error: true, infras });
return;
}
if (validEvents.length == 0) {
return;
}
for (let i = 0; i < infras.length; i++) {
if (!this.state.maxStep[infras[i].kind]) {
skip = true;
}
}
if (!skip) {
for (let key in this.state.maxStep) {
maxStep += this.state.maxStep[key]
currentStep += this.state.currentStep[key]
}
}
if (maxStep !== 0 && currentStep === maxStep && !triggerEnd) {
posthog.capture('Provisioning complete!')
this.onEnd()
this.setState({ triggerEnd: true });
}
return (
{error ? (
<>
<title>
<img src={warning} /> Provisioning Error
</title>
Porter encountered an error while provisioning.