Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix resources bug #907

Merged
merged 2 commits into from
Apr 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We shouldn't use this pattern, since the error message don't add any extra value about the err.

} 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