Skip to content

Commit

Permalink
Directory name must be different from robot name
Browse files Browse the repository at this point in the history
  • Loading branch information
gdepuille committed May 3, 2024
1 parent 483f01d commit a9c4496
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 3 deletions.
3 changes: 3 additions & 0 deletions src/models/Robot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ export class Robot extends Model<Robot> {
@Column
name: string;

@Column
dirName: string;

@Column
simulateur: boolean;

Expand Down
3 changes: 2 additions & 1 deletion src/services/BashService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ export class BashService {
this.log.info(`Copy all logs for ${robotId} ${robot.name} from ${host} to ${dir}`);

return new Promise((resolve, reject) => {
const getLogs = child.spawn(this.GET_LOGS_SH, [host, robot.name.toLowerCase(), dir], {
let robotName = robot.dirName !== undefined ? robot.dirName.toLowerCase() : robot.name.toLowerCase();

Check failure on line 32 in src/services/BashService.ts

View workflow job for this annotation

GitHub Actions / build

'robotName' is never reassigned. Use 'const' instead
const getLogs = child.spawn(this.GET_LOGS_SH, [host, robotName, dir], {
cwd: process.cwd()
});

Expand Down
12 changes: 10 additions & 2 deletions src/services/RobotService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ export class RobotService {
private log: Logger;

buildDir(robot: Robot): string {
let dirName = robot.dirName !== undefined ? robot.dirName.toLowerCase() : robot.name.toLowerCase();

Check failure on line 17 in src/services/RobotService.ts

View workflow job for this annotation

GitHub Actions / build

'dirName' is never reassigned. Use 'const' instead

if (robot.simulateur) {
return `${this.config.logsOutput}-simulateur/${robot.name.toLowerCase()}`;
return `${this.config.logsOutput}-simulateur/${dirName}`;
} else {
return `${this.config.logsOutput}/${robot.name.toLowerCase()}`;
return `${this.config.logsOutput}/${dirName}`;
}
}

Expand Down Expand Up @@ -92,41 +94,47 @@ export class RobotService {
new Robot({
host : 'pami-triangle:8082',
name : 'Pami △',
dirName : 'pami-triangle',
simulateur: false,
}).save();
}
if (!hasPamiTriangleSimu) {
new Robot({
host : 'localhost:8082',
name : 'Pami △',
dirName : 'pami-triangle',
simulateur: true,
}).save();
}
if (!hasPamiCarre) {
new Robot({
host : 'pami-carre:8083',
name : 'Pami ▢',
dirName : 'pami-carre',
simulateur: false,
}).save();
}
if (!hasPamiCarreSimu) {
new Robot({
host : 'localhost:8083',
name : 'Pami ▢',
dirName : 'pami-carre',
simulateur: true,
}).save();
}
if (!hasPamiRond) {
new Robot({
host : 'pami-rond:8084',
name : 'Pami ○',
dirName : 'pami-rond',
simulateur: false,
}).save();
}
if (!hasPamiRondSimu) {
new Robot({
host : 'localhost:8084',
name : 'Pami ○',
dirName : 'pami-rond',
simulateur: true,
}).save();
}
Expand Down

0 comments on commit a9c4496

Please sign in to comment.