Skip to content

Commit

Permalink
fix(moniker): Use the correct moniker when applying source server group
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewbackes committed Nov 15, 2017
1 parent 3e953ac commit 1d97528
Showing 1 changed file with 22 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ package com.netflix.spinnaker.orca.clouddriver.pipeline.providers.aws
import com.fasterxml.jackson.annotation.JsonIgnore
import com.fasterxml.jackson.annotation.JsonProperty
import com.fasterxml.jackson.databind.ObjectMapper
import com.netflix.spinnaker.moniker.Moniker
import com.netflix.spinnaker.orca.clouddriver.pipeline.servergroup.ResizeServerGroupStage
import com.netflix.spinnaker.orca.clouddriver.tasks.servergroup.AbstractServerGroupTask
import com.netflix.spinnaker.orca.clouddriver.utils.MonikerHelper
import com.netflix.spinnaker.orca.clouddriver.utils.OortHelper
import com.netflix.spinnaker.orca.kato.pipeline.support.StageData
import com.netflix.spinnaker.orca.pipeline.model.Stage
Expand Down Expand Up @@ -80,6 +82,26 @@ class ApplySourceServerGroupCapacityTask extends AbstractServerGroupTask {
}
}

@Override
Moniker convertMoniker(Stage stage) {
try {
TargetServerGroupContext context = getTargetServerGroupContext(stage)
return MonikerHelper.friggaToMoniker(context.serverGroupName)

def targetServerGroup = oortHelper.getTargetServerGroup(
context.credentials as String,
context.serverGroupName as String,
context.region as String,
context.cloudProvider as String
).get()

return targetServerGroup.getMoniker()
} catch (Exception e) {
log.error("Unable to apply source server group capacity (executionId: ${stage.execution.id})", e)
return null
}
}

/**
* Fetch target server group coordinates and source server group capacity snapshot.
*
Expand Down

0 comments on commit 1d97528

Please sign in to comment.