Skip to content

Commit

Permalink
refactor(google): use Optional.ofNullable() instead of if/else (#4093)
Browse files Browse the repository at this point in the history
  • Loading branch information
plumpy authored and mergify[bot] committed Oct 18, 2019
1 parent 042cfcb commit 102dd48
Showing 1 changed file with 1 addition and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -132,12 +132,7 @@ class UpsertGoogleLoadBalancerAtomicOperation extends GoogleAtomicOperation<Map>
project, region, GCEUtil.getLocalName(existingForwardingRule.target), compute, task, BASE_PHASE, this)

if (existingTargetPool) {
GoogleSessionAffinity newSessionAffinity
if (description.sessionAffinity == null) {
newSessionAffinity = GoogleSessionAffinity.NONE
} else {
newSessionAffinity = description.sessionAffinity
}
GoogleSessionAffinity newSessionAffinity = Optional.ofNullable(description.sessionAffinity).orElse(GoogleSessionAffinity.NONE)
boolean sessionAffinityChanged = newSessionAffinity != GoogleSessionAffinity.valueOf(existingTargetPool.getSessionAffinity())
if (sessionAffinityChanged && existingTargetPool.instances.any()) {
task.updateStatus BASE_PHASE, "Impossible to change Session Affinity for target pool with existing instances."
Expand Down

0 comments on commit 102dd48

Please sign in to comment.