summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--deployment-handler-API.yaml28
-rw-r--r--deployment-handler.js14
-rw-r--r--lib/cloudify.js59
-rw-r--r--lib/config.js1
-rw-r--r--package.json2
-rw-r--r--pom.xml2
-rw-r--r--version.properties4
7 files changed, 74 insertions, 36 deletions
diff --git a/deployment-handler-API.yaml b/deployment-handler-API.yaml
index 887e336..b85a554 100644
--- a/deployment-handler-API.yaml
+++ b/deployment-handler-API.yaml
@@ -20,7 +20,7 @@
swagger: '2.0'
info:
- version: "4.2.0"
+ version: "4.3.0"
title: "deployment-handler API"
license:
name: "Apache 2.0"
@@ -137,6 +137,12 @@ paths:
in: path
type: string
required: true
+ - name: cfy_tenant_name
+ description: |
+ Tenant Name in Cloudify. Optional, if not specified, "default_tenant" will be used.
+ in: path
+ type: string
+ required: false
- name: body
in: body
@@ -258,6 +264,12 @@ paths:
in: path
type: string
required: true
+ - name: cfy_tenant_name
+ description: |
+ Tenant Name in Cloudify. Optional, if not specified, "default_tenant" will be used.
+ in: path
+ type: string
+ required: false
responses:
@@ -304,6 +316,12 @@ paths:
- application/json
parameters:
+ - name: cfy_tenant_name
+ description: |
+ Tenant Name in Cloudify. Optional, if not specified, "default_tenant" will be used.
+ in: path
+ type: string
+ required: false
- name: body
in: body
schema:
@@ -322,6 +340,14 @@ paths:
produces:
- application/json
+ parameters:
+ - name: cfy_tenant_name
+ description: |
+ Tenant Name in Cloudify. Optional, if not specified, "default_tenant" will be used.
+ in: path
+ type: string
+ required: false
+
responses:
200:
description: deployment-handler found components with or without policies in cloudify
diff --git a/deployment-handler.js b/deployment-handler.js
index bc1a85a..2ae1391 100644
--- a/deployment-handler.js
+++ b/deployment-handler.js
@@ -1,5 +1,5 @@
/*
-Copyright(c) 2017 AT&T Intellectual Property. All rights reserved.
+Copyright(c) 2017-2018 AT&T Intellectual Property. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -18,7 +18,7 @@ See the License for the specific language governing permissions and limitations
"use strict";
-const API_VERSION = "4.2.0";
+const API_VERSION = "4.3.0";
const fs = require('fs');
const util = require('util');
@@ -78,6 +78,7 @@ const start = function(config) {
process.mainModule.exports.config = config;
log.info(null, "Configuration: " + JSON.stringify(config));
+ console.log( (new Date()) + ": Configuration: " + JSON.stringify(config, undefined, 2) );
set_app();
@@ -119,9 +120,11 @@ const start = function(config) {
/* Set up handling for terminate signal */
process.on('SIGTERM', function() {
var startTime = new Date();
- log.metrics(null, {startTime: startTime, complete: true}, "Deployment Handler API shutting down.")
+ log.metrics(null, {startTime: startTime, complete: true}, "Deployment Handler API shutting down.");
+ console.log( "startTime: " + startTime + ": Deployment Handler API shutting down." )
server.close(function() {
- log.metrics(null, {startTime: startTime, complete: true}, "Deployment Handler API server shut down.")
+ log.metrics(null, {startTime: startTime, complete: true}, "Deployment Handler API server shut down.");
+ console.log( "startTime: " + startTime + ": Deployment Handler API shutting down" )
});
});
@@ -134,7 +137,8 @@ const start = function(config) {
process.on('beforeExit', function() {
if (!loggedExit) {
loggedExit = true;
- log.metrics(null, {startTime: startTime, complete: true}, "Deployment Handler process exiting.")
+ log.metrics(null, {startTime: startTime, complete: true}, "Deployment Handler process exiting.");
+ console.log( "startTime: " + startTime + ": Deployment Handler process exiting." )
}
});
};
diff --git a/lib/cloudify.js b/lib/cloudify.js
index 0832dc7..2db460a 100644
--- a/lib/cloudify.js
+++ b/lib/cloudify.js
@@ -22,9 +22,7 @@ const CLOUDIFY = "cloudify-manager";
const FINISHED = [ "terminated", "cancelled", "failed" ];
const RETRY_INTERVAL = 5000; // Every 5 seconds
const MAX_TRIES = 720; // Up to 1 hour
-
-const TENANT = "default_tenant"; // Tenant name for Cloudify 4.x
-
+const DEFAULT_TENANT = "default_tenant";
const doRequest = require('./promise_request').doRequest;
const repeat = require('./repeat');
const admzip = require('adm-zip');
@@ -83,7 +81,9 @@ const getExecutionStatus = function(req, execution_id) {
method : "GET",
uri : cfyAPI + "/executions/" + execution_id
};
- addAuthToOptions(reqOptions);
+
+ addAuthToOptions(reqOptions, req);
+
return doRequest(req, reqOptions, null, CLOUDIFY);
};
@@ -174,7 +174,9 @@ const startWorkflowExecution = function(mainReq, deployment_id, workflow_id, par
"Accept" : "*/*"
}
};
- addAuthToOptions(reqOptions);
+
+ addAuthToOptions(reqOptions, mainReq);
+
var body = {
"deployment_id" : deployment_id,
"workflow_id" : workflow_id
@@ -212,14 +214,14 @@ exports.uploadBlueprint = function(req, bpid, blueprint) {
// Set up the HTTP PUT request
const reqOptions = {
- method : "PUT",
- uri : cfyAPI + "/blueprints/" + bpid,
- headers : {
- "Content-Type" : "application/octet-stream",
- "Accept" : "*/*"
- }
+ method : "PUT",
+ uri : cfyAPI + "/blueprints/" + bpid,
+ headers : {
+ "Content-Type" : "application/octet-stream",
+ "Accept" : "*/*"
+ }
};
- addAuthToOptions(reqOptions);
+ addAuthToOptions(reqOptions, req);
// Initiate PUT request and return the promise for a result
return doRequest(req, reqOptions, zip_buffer, CLOUDIFY);
@@ -237,7 +239,7 @@ exports.createDeployment = function(req, dpid, bpid, inputs) {
"Accept" : "*/*"
}
};
- addAuthToOptions(reqOptions);
+ addAuthToOptions(reqOptions, req);
var body = {
blueprint_id : bpid
@@ -280,7 +282,8 @@ exports.getOutputs = function(req, dpid) {
"Accept" : "*/*"
}
};
- addAuthToOptions(reqOptions);
+
+ addAuthToOptions(reqOptions, req);
return doRequest(req, reqOptions, null, CLOUDIFY);
};
@@ -294,7 +297,8 @@ exports.getOutputDescriptions = function(req, dpid) {
"Accept" : "*/*"
}
};
- addAuthToOptions(reqOptions);
+
+ addAuthToOptions(reqOptions, req);
return doRequest(req, reqOptions, null, CLOUDIFY);
};
@@ -305,7 +309,8 @@ exports.deleteDeployment = function(req, dpid) {
method : "DELETE",
uri : cfyAPI + "/deployments/" + dpid
};
- addAuthToOptions(reqOptions);
+
+ addAuthToOptions(reqOptions, req);
return doRequest(req, reqOptions, null, CLOUDIFY);
};
@@ -316,7 +321,8 @@ exports.deleteBlueprint = function(req, bpid) {
method : "DELETE",
uri : cfyAPI + "/blueprints/" + bpid
};
- addAuthToOptions(reqOptions);
+
+ addAuthToOptions(reqOptions, req);
return doRequest(req, reqOptions, null, CLOUDIFY);
};
@@ -331,16 +337,16 @@ exports.setCredentials = function(user, password) {
cfyAuth = cfyAuth || (user + ':' + password);
};
-function addAuthToOptions(reqOptions) {
+function addAuthToOptions(reqOptions, req) {
+
if (!!cfyAuth && cfyAuth !== "undefined:undefined") {
reqOptions.auth = cfyAuth;
}
- if (reqOptions.headers) {
- reqOptions.headers.Tenant = TENANT;
- }
- else {
- reqOptions.headers = {"Tenant" : TENANT};
- }
+ reqOptions.headers = reqOptions.headers || {};
+ reqOptions.headers.Tenant = req.query.cfy_tenant_name || DEFAULT_TENANT;
+
+ logger.debug(req.dcaeReqId, "Calling " + reqOptions.uri + " with Tenant: " + reqOptions.headers.Tenant );
+
}
// Set a logger
@@ -352,9 +358,10 @@ exports.getNodeInstances = function (mainReq, on_next_node_instances, offset) {
offset = offset || 0;
var reqOptions = {
method : "GET",
- uri : cfyAPI + "/node-instances?_include=id,deployment_id,runtime_properties&_size=1000&_offset=" + offset
+ uri : cfyAPI + "/node-instances?_include=id,deployment_id,runtime_properties&_offset=" + offset
};
- addAuthToOptions(reqOptions);
+
+ addAuthToOptions(reqOptions, mainReq);
logger.info(mainReq.dcaeReqId, "getNodeInstances: " + JSON.stringify(reqOptions));
return doRequest(mainReq, reqOptions, null, CLOUDIFY)
diff --git a/lib/config.js b/lib/config.js
index 700f95d..fd7d38c 100644
--- a/lib/config.js
+++ b/lib/config.js
@@ -214,6 +214,7 @@ exports.configure = function() {
throw new Error ("Required configuration elements missing: " + missing.join(','));
config = null;
}
+ console.log( (new Date()) + ": config -> " + JSON.stringify(config, undefined, 2));
return config;
});
};
diff --git a/package.json b/package.json
index 6f587b4..033d064 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "onap-dcae-deployment-handler",
- "version": "4.4.5",
+ "version": "4.5.0",
"description": "ONAP DCAE Deployment Handler",
"main": "deployment-handler.js",
"dependencies": {
diff --git a/pom.xml b/pom.xml
index 2e2e381..a076d59 100644
--- a/pom.xml
+++ b/pom.xml
@@ -29,7 +29,7 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property.
<groupId>org.onap.dcaegen2.platform</groupId>
<artifactId>deployment-handler</artifactId>
<name>dcaegen2-platform-deployment-handler</name>
- <version>2.1.5-SNAPSHOT</version>
+ <version>2.2.0-SNAPSHOT</version>
<url>http://maven.apache.org</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
diff --git a/version.properties b/version.properties
index 201272e..5791c10 100644
--- a/version.properties
+++ b/version.properties
@@ -1,6 +1,6 @@
major=2
-minor=1
-patch=5
+minor=2
+patch=0
base_version=${major}.${minor}.${patch}
release_version=${base_version}
snapshot_version=${base_version}-SNAPSHOT