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

[BUG] Update versions and improve error handling #489

Merged
merged 1 commit into from
Nov 17, 2024
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 .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
/.data.dev/
.idea/
.idea/
/.idea/
2 changes: 1 addition & 1 deletion client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ssm-client",
"version": "0.1.23",
"version": "0.1.24",
"private": true,
"description": "SSM Client - A simple way to manage all your servers",
"author": "Squirrel Team",
Expand Down
2 changes: 1 addition & 1 deletion server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"test:python:run": "cd ./src/ansible && python3 -m unittest discover -s . -p \"*.py\"",
"coverage": "vitest run --coverage"
},
"version": "0.1.23",
"version": "0.1.24",
"author": "Squirrel Team",
"dependencies": {
"@aws-sdk/client-ecr": "^3.687.0",
Expand Down
7 changes: 6 additions & 1 deletion server/src/controllers/rest/user/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { getAnsibleRunnerVersion, getAnsibleVersion } from '../../../core/system
import { getFromCache, getIntConfFromCache } from '../../../data/cache';
import { Role } from '../../../data/database/model/User';
import UserRepo from '../../../data/database/repository/UserRepo';
import logger from '../../../logger';
import { AuthFailureError } from '../../../middlewares/api/ApiError';
import { SuccessResponse } from '../../../middlewares/api/ApiResponse';
import { createADefaultLocalUserRepository } from '../../../modules/repository/default-playbooks-repositories';
Expand Down Expand Up @@ -110,7 +111,11 @@ export const createFirstUser = async (req, res) => {
role: Role.ADMIN,
avatar: avatar || '/avatars/squirrel.svg',
});
await createADefaultLocalUserRepository();
try {
await createADefaultLocalUserRepository();
} catch (error: any) {
logger.error(error);
}
new SuccessResponse('Create first user').send(res);
};

Expand Down
8 changes: 1 addition & 7 deletions server/src/core/startup/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class Startup {

private async initializeModules() {
await PlaybooksRepositoryEngine.init();
void PlaybooksRepositoryEngine.syncAllRegistered();
void sshPrivateKeyFileManager.removeAllAnsibleTemporaryPrivateKeys();
void NotificationComponent.init();
void Crons.initScheduledJobs();
Expand Down Expand Up @@ -89,13 +90,6 @@ class Startup {
this.logger.error(`Error setting Ansible versions: ${error.message}`);
}

try {
await PlaybooksRepositoryEngine.syncAllRegistered();
this.logger.info('All registered playbooks synced successfully.');
} catch (error: any) {
this.logger.error(`Error syncing all registered playbooks: ${error.message}`);
}

try {
this.registerPersistedProviders();
this.logger.info('Persisted providers registered successfully.');
Expand Down
2 changes: 1 addition & 1 deletion shared-lib/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ssm-shared-lib",
"version": "0.1.23",
"version": "0.1.24",
"description": "",
"main": "./distribution/index.js",
"author": "Squirrel Team",
Expand Down
2 changes: 1 addition & 1 deletion shared-lib/src/enums/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export enum GeneralSettingsKeys {
}

export enum DefaultValue {
SCHEME_VERSION = '16',
SCHEME_VERSION = '17',
SERVER_LOG_RETENTION_IN_DAYS = '30',
CONSIDER_DEVICE_OFFLINE_AFTER_IN_MINUTES = '3',
CONSIDER_PERFORMANCE_GOOD_MEM_IF_GREATER = '10',
Expand Down