Skip to content
This repository has been archived by the owner on Jul 11, 2022. It is now read-only.

Commit

Permalink
[1119781] runtime name provided for deployment child creation overrid…
Browse files Browse the repository at this point in the history
…es application name and path

Use the deploymentName as appropriate, the runtimeName should be an attribute
on the deployment and can be the same on multiple deployments, the
deploymentName must be unique among deployments.

-- incidental: several logging auto-formatting changes.

Cherry-pick of master 5ab4508
  • Loading branch information
jshaughn committed Jul 24, 2014
1 parent 01c7bb3 commit 0a4c817
Showing 1 changed file with 21 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,8 @@ public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest>
* @param explicitExpressions set of metric names that could be represented by expression instead of value on AS7 (can be null)
* @return ReadMetricResult value that if different from 'Success' determines why we failed to read metric
*/
protected ReadMetricResult getMetricValue(MeasurementReport report, MeasurementScheduleRequest req, Set<String> explicitExpressions) {
protected ReadMetricResult getMetricValue(MeasurementReport report, MeasurementScheduleRequest req,
Set<String> explicitExpressions) {
if (req.getName().startsWith(INTERNAL))
processPluginStats(req, report);
else {
Expand All @@ -208,7 +209,7 @@ protected ReadMetricResult getMetricValue(MeasurementReport report, MeasurementS
if (reqName.startsWith(EXPRESSION)) {
resolveExpression = true;
reqName = reqName.substring(EXPRESSION_SIZE);
} else if (explicitExpressions!=null && explicitExpressions.contains(reqName)) {
} else if (explicitExpressions != null && explicitExpressions.contains(reqName)) {
resolveExpression = true;
}

Expand All @@ -223,8 +224,9 @@ protected ReadMetricResult getMetricValue(MeasurementReport report, MeasurementS

Result res = getASConnection().execute(op);
if (!res.isSuccess()) {
getLog().warn("Getting metric [" + req.getName() + "] at [ " + address + "] failed: "
+ res.getFailureDescription());
getLog().warn(
"Getting metric [" + req.getName() + "] at [ " + address + "] failed: "
+ res.getFailureDescription());
return ReadMetricResult.RequestFailed;
}

Expand Down Expand Up @@ -259,9 +261,10 @@ protected ReadMetricResult getMetricValue(MeasurementReport report, MeasurementS
Result result = getASConnection().execute(resolveExpressionOperation);
if (!result.isSuccess()) {
if (getLog().isWarnEnabled()) {
getLog().warn("Skipping trait [" + req.getName()
+ "] in measurement report. Could not resolve expression [" + expression
+ "], failureDescription:" + result.getFailureDescription());
getLog().warn(
"Skipping trait [" + req.getName()
+ "] in measurement report. Could not resolve expression [" + expression
+ "], failureDescription:" + result.getFailureDescription());
return ReadMetricResult.ResolveFailed;
}
}
Expand All @@ -284,9 +287,9 @@ private void addMetric2Report(MeasurementReport report, MeasurementScheduleReque
Result result = getASConnection().execute(resolveExpressionOperation);
if (!result.isSuccess()) {
if (getLog().isWarnEnabled()) {
getLog().warn("Skipping metric [" + req.getName()
+ "] in measurement report. Could not resolve expression [" + expression
+ "], failureDescription:" + result.getFailureDescription());
getLog().warn(
"Skipping metric [" + req.getName() + "] in measurement report. Could not resolve expression ["
+ expression + "], failureDescription:" + result.getFailureDescription());
return;
}
}
Expand Down Expand Up @@ -491,8 +494,7 @@ protected CreateResourceReport deployContent(CreateResourceReport report) {

long size = 0L;
try {
size = contentServices.downloadPackageBitsForChildResource(cctx, resourceTypeName, details.getKey(),
out);
size = contentServices.downloadPackageBitsForChildResource(cctx, resourceTypeName, details.getKey(), out);
} catch (Exception e) {
uploadConnection.cancelUpload();
report.setStatus(CreateResourceStatus.FAILURE);
Expand Down Expand Up @@ -548,11 +550,13 @@ public CreateResourceReport runDeploymentMagicOnServer(CreateResourceReport repo
String deploymentName, String hash) {

boolean toServerGroup = context.getResourceKey().contains("server-group=");
getLog().info("Deploying [" + runtimeName + "] (toDomainOnly=" + !toServerGroup + ")...");
getLog().info(
"Deploying [" + deploymentName + " (runtimeName=" + runtimeName + ")] (toDomainOnly=" + !toServerGroup
+ ")...");

ASConnection connection = getASConnection();

Operation step1 = new Operation("add", "deployment", runtimeName);
Operation step1 = new Operation("add", "deployment", deploymentName);
// step1.addAdditionalProperty("hash", new PROPERTY_VALUE("BYTES_VALUE", hash));
List<Object> content = new ArrayList<Object>(1);
Map<String, Object> contentValues = new HashMap<String, Object>();
Expand Down Expand Up @@ -939,8 +943,9 @@ protected void collectMulticastAddressTrait(MeasurementReport report, Measuremen
if (defaultValue != null) {
multicastHost = defaultValue;
} else {
getLog().error("Failed to resolve expression value [" + expressionValue
+ "] of 'multicast-address' attribute.");
getLog().error(
"Failed to resolve expression value [" + expressionValue
+ "] of 'multicast-address' attribute.");
}
}
}
Expand Down

0 comments on commit 0a4c817

Please sign in to comment.