Skip to content

Commit

Permalink
Merge pull request #527 from byxorna/gabe-416-default-address-pool
Browse files Browse the repository at this point in the history
AddressPool name conversion should always handle defaultPoolName correctly
  • Loading branch information
byxorna authored Mar 14, 2017
2 parents 1d8997e + ac0dfa1 commit 364df19
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,8 @@ trait AddressActionHelper { self: SecureAction =>
))
}

def convertPoolName(name: String, emptyToDef: Boolean = false) = name match {
case default if default.equalsIgnoreCase(IpAddressConfig.DefaultPoolName) =>
""
case empty if empty.isEmpty && emptyToDef =>
def convertPoolName(name: String) = name match {
case empty if empty.isEmpty =>
IpAddressConfig.DefaultPoolName
case other => other.toUpperCase
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ case class GetPoolsAction(
protected def toJsonList(pools: Set[AddressPool]): JsArray = JsArray(
pools.toList.map { pool =>
val seq = Seq(
"NAME" -> JsString(convertPoolName(pool.name, true)),
"NAME" -> JsString(convertPoolName(pool.name)),
"NETWORK" -> JsString(formatNetworkAddress(pool.network)),
"START_ADDRESS" -> JsString(pool.startAddress.getOrElse("Unspecified")),
"SPECIFIED_GATEWAY" -> JsString(pool.gateway.getOrElse("Unspecified")),
Expand Down

0 comments on commit 364df19

Please sign in to comment.