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

Maksimchepelev/bugs #532

Merged
merged 2 commits into from
Feb 7, 2019
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: 1 addition & 2 deletions src/cli/microservice.js
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,7 @@ const _createVolumeMapping = async function (obj, user) {

const _removePortMapping = async function (obj, user) {
try {
const internalPort = parseInt(obj.internalPort);
await MicroserviceService.deletePortMapping(obj.microserviceUuid, internalPort, user, true);
await MicroserviceService.deletePortMapping(obj.microserviceUuid, obj.internalPort, user, true);
logger.info('Port mapping has been removed successfully.');
} catch (e) {
logger.error(e.message);
Expand Down
1 change: 1 addition & 0 deletions src/helpers/error-messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ module.exports = {
RESTRICTED_PUBLISHER: "You are not allowed to add catalog item as 'Eclipse ioFog' publisher",
REQUIRED_FOG_NODE: 'ioFog node is required.',
PORT_MAPPING_ALREADY_EXISTS: 'Port mapping already exists',
PORT_MAPPING_INTERNAL_PORT_NOT_PROVIDED: 'Internal port wasn\'t provided',
VOLUME_MAPPING_ALREADY_EXISTS: 'Volume mapping already exists',
INVALID_CONNECTOR_DOMAIN: 'Invalid connector domain {}',
CERT_PROPERTY_REQUIRED: 'Property "certificate" is required if property "requiresCert" is set to true',
Expand Down
3 changes: 0 additions & 3 deletions src/services/connector-port-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ async function closePortOnConnector(connector, ports) {
let data = qs.stringify({
mappingid: ports.mappingId
});
console.log(data);

let port = connector.devMode ? constants.CONNECTOR_HTTP_PORT : constants.CONNECTOR_HTTPS_PORT;

Expand All @@ -115,7 +114,6 @@ async function closePortOnConnector(connector, ports) {
async function _makeRequest(connector, options, data) {
return new Promise((resolve, reject) => {
let httpreq = (connector.devMode ? http : https).request(options, function (response) {
console.log(response.statusCode);
let output = '';
response.setEncoding('utf8');

Expand All @@ -134,7 +132,6 @@ async function _makeRequest(connector, options, data) {
});

httpreq.on('error', function (err) {
console.log(err);
if (err instanceof Error)
return reject(new Error(err.message));
else
Expand Down
3 changes: 3 additions & 0 deletions src/services/microservices-service.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,9 @@ async function deletePortMapping(microserviceUuid, internalPort, user, isCLI, tr
? {uuid: microserviceUuid}
: {uuid: microserviceUuid, userId: user.id};

if (!internalPort) {
throw new Errors.ValidationError(ErrorMessages.PORT_MAPPING_INTERNAL_PORT_NOT_PROVIDED);
}
const microservice = await MicroserviceManager.findOne(where, transaction);
if (!microservice) {
throw new Errors.NotFoundError(AppHelper.formatMessage(ErrorMessages.INVALID_MICROSERVICE_UUID, microserviceUuid))
Expand Down