Skip to content

Commit

Permalink
Fix resources bug (#907)
Browse files Browse the repository at this point in the history
* Fix prometheus and tempo resources write

* fix(orchestrator): build and some typos

---------

Co-authored-by: Javier Viola <javier@parity.io>
  • Loading branch information
wirednkod and pepoviola authored Apr 8, 2023
1 parent d449e3e commit eff0684
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
3 changes: 2 additions & 1 deletion javascript/packages/orchestrator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@
},
"scripts": {
"clean": "rm -rf ./dist/*",
"build": "tsc",
"build": "tsc && npm run copy:podman",
"copy:podman": "cp -r src/providers/podman/resources/configs dist/providers/podman/resources",
"lint": "npx prettier --check ./src",
"lint:write": "npx prettier --write ./src",
"test": "echo \"Error: no test specified\" && exit 1"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getRandomPort, makeDir } from "@zombienet/utils";
import { decorators, getRandomPort, makeDir } from "@zombienet/utils";
import fs from "fs/promises";
import path from "path";
import { Client } from "../../client";
Expand Down Expand Up @@ -56,8 +56,11 @@ export class GrafanaResource {
`${this.dataSourcesPath}/prometheus.yml`,
grafanaConfig,
);
} catch {
throw new Error("Error generating config for grafana resource");
} catch (err) {
console.error(
decorators.red("Error generating config for grafana resource"),
);
throw err;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export class PrometheusResource {
private readonly dataPath: string;

constructor(client: Client, private readonly namespace: string) {
const nodeRootPath = `${client.tmpDir}/prometeus`;
const nodeRootPath = `${client.tmpDir}/prometheus`;
this.configPath = `${nodeRootPath}/etc`;
this.dataPath = `${nodeRootPath}/data`;
}
Expand Down Expand Up @@ -44,9 +44,9 @@ export class PrometheusResource {
__dirname,
"./configs/prometheus.yml",
);
await fs.copyFile(
templateConfigPath,
await fs.writeFile(
`${this.configPath}/prometheus.yml`,
templateConfigPath,
);
} catch {
throw new Error("Error generating config for prometheus resource");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export class TempoResource {
__dirname,
`./configs/tempo.yaml`,
);
await fs.copyFile(templateConfigPath, `${this.configPath}/tempo.yaml`);
await fs.writeFile(`${this.configPath}/tempo.yaml`, templateConfigPath);
} catch {
throw new Error("Error generating config for tempo resource");
}
Expand Down

0 comments on commit eff0684

Please sign in to comment.