Skip to content

Commit

Permalink
Merge pull request #489 from SquirrelCorporation/bug-fix-sync-playboo…
Browse files Browse the repository at this point in the history
…ks-first-time

[BUG] Update versions and improve error handling
  • Loading branch information
SquirrelDeveloper authored Nov 17, 2024
2 parents cc253a2 + 1cdd8de commit 81317a8
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 13 deletions.
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

0 comments on commit 81317a8

Please sign in to comment.