Skip to content
Merged

bugs #403

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
6 changes: 3 additions & 3 deletions src/cli/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/cli/microservice.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
};

Expand Down
4 changes: 1 addition & 3 deletions src/services/connector-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -180,8 +180,6 @@ async function _getRandomConnector(transaction) {
}

async function closePortOnConnector(connector, ports, transaction) {
console.log(ports);

let data = qs.stringify({
mappingid: ports.mappingId
});
Expand Down
9 changes: 5 additions & 4 deletions src/services/microservices-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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"))
}

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down