diff --git a/src/cli/config.js b/src/cli/config.js index f9626c70a..ce42ea944 100644 --- a/src/cli/config.js +++ b/src/cli/config.js @@ -156,15 +156,15 @@ const _addConfigOption = async function (options) { onSuccess(); }); - if (options.sslKey) { + await updateConfig(options.sslKey, 'ssl-key', 'Server:SslKey', (onSuccess) => { const sslKey = options.sslKey; if (!AppHelper.isFileExists(sslKey)) { logger.error(ErrorMessages.INVALID_FILE_PATH); return; } config.set('Server:SslKey', sslKey); - logger.info('Config option ssl-key has been updated.'); - } + onSuccess(); + }); await updateConfig(options.intermediateCert, 'intermediate-cert', 'Server:IntermediateCert', (onSuccess) => { const intermediateCert = options.intermediateCert; diff --git a/src/cli/microservice.js b/src/cli/microservice.js index 33b982fab..ea3550546 100644 --- a/src/cli/microservice.js +++ b/src/cli/microservice.js @@ -376,7 +376,7 @@ const _removeVolumeMapping = async function (obj, user) { await MicroserviceService.deleteVolumeMapping(obj.microserviceId, obj.mappingId, user, true); logger.info('Volume mapping has been deleted successfully.'); } catch (e) { - logger.error(ErrorMessages.CLI.INVALID_VOLUME_MAPPING); + logger.error(e.message); } }; diff --git a/src/services/connector-service.js b/src/services/connector-service.js index b0e19853b..bd522e6ac 100644 --- a/src/services/connector-service.js +++ b/src/services/connector-service.js @@ -160,7 +160,7 @@ async function openPortsOnConnector(connector, isPublicAccess, transaction) { 'Content-Length': Buffer.byteLength(data) } }; - if (connector.cert && connector.isSelfSignedCert === true) { + if (!connector.devMode && connector.cert && connector.isSelfSignedCert === true) { const ca = fs.readFileSync(connector.cert); options.ca = new Buffer(ca); } @@ -180,8 +180,6 @@ async function _getRandomConnector(transaction) { } async function closePortOnConnector(connector, ports, transaction) { - console.log(ports); - let data = qs.stringify({ mappingid: ports.mappingId }); diff --git a/src/services/microservices-service.js b/src/services/microservices-service.js index fa5e6d2c4..7b4707c5e 100644 --- a/src/services/microservices-service.js +++ b/src/services/microservices-service.js @@ -11,6 +11,7 @@ * */ +const logger = require('../logger') const TransactionDecorator = require('../decorators/transaction-decorator'); const MicroserviceManager = require('../sequelize/managers/microservice-manager'); const MicroserviceStatusManager = require('../sequelize/managers/microservice-status-manager'); @@ -187,7 +188,7 @@ async function _updateMicroservice(microserviceUuid, microserviceData, user, isC await _updateVolumeMappings(microserviceDataUpdate.volumeMappings, microserviceUuid, transaction); } - if (microserviceDataUpdate.iofogUuid !== microservice.iofogUuid) { + if (microserviceDataUpdate.iofogUuid && microserviceDataUpdate.iofogUuid !== microservice.iofogUuid) { const routes = await _getLogicalNetworkRoutesByFog(microservice.iofogUuid, transaction); for (let route of routes) { await _deleteRoute(route.sourceMicroserviceUuid, route.destMicroserviceUuid, user, isCLI, transaction); @@ -386,7 +387,7 @@ async function _createRouteOverConnector(sourceMicroservice, destMicroservice, u const networkCatalogItem = await CatalogService.getNetworkCatalogItem(transaction) let cert; - if (connector.cert) { + if (!connector.devMode && connector.cert) { cert = AppHelper.trimCertificate(fs.readFileSync(connector.cert, "utf-8")) } @@ -527,7 +528,7 @@ async function _deleteRouteOverConnector(route, transaction) { try { await ConnectorService.closePortOnConnector(connector, ports, transaction); } catch (e) { - logger.warn(`Can't close ports pair ${ports.mappingId} on connector ${connector.publicIp}. Delete manually in needed`); + logger.warn(`Can't close ports pair ${ports.mappingId} on connector ${connector.publicIp}. Delete manually if necessary`); } await RoutingManager.delete({id: route.id}, transaction) @@ -617,7 +618,7 @@ async function _createPortMappingOverConnector(microservice, portMappingData, us const networkCatalogItem = await CatalogService.getNetworkCatalogItem(transaction) let cert; - if (connector.cert) { + if (!connector.devMode && connector.cert) { cert = AppHelper.trimCertificate(fs.readFileSync(connector.cert, "utf-8")); } //create netw ms1