Skip to content

Commit

Permalink
OP-11873: Fixed external spinnaker case. (#124) (#129)
Browse files Browse the repository at this point in the history
* OP-11837: Added external gate

* OP-11837: added log

* OP-11837: removed log
  • Loading branch information
rahul-chekuri authored Feb 8, 2022
1 parent 17b0e7b commit 69b392f
Showing 1 changed file with 17 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,18 @@

package com.netflix.spinnaker.gate.controllers


import com.netflix.spinnaker.gate.services.internal.OpsmxDashboardService
import com.opsmx.spinnaker.gate.enums.GateInstallationModes
import com.opsmx.spinnaker.gate.factory.dashboard.DashboardCachingServiceBeanFactory
import com.opsmx.spinnaker.gate.service.DashboardCachingService
import com.opsmx.spinnaker.gate.util.CacheUtil
import groovy.util.logging.Slf4j
import io.swagger.annotations.ApiOperation
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.beans.factory.annotation.Value
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression
import org.springframework.web.bind.annotation.*

import javax.servlet.http.Cookie
import javax.servlet.http.HttpServletRequest

@RequestMapping("/dashboardservice")
Expand Down Expand Up @@ -57,6 +57,9 @@ class OpsmxDashboardController {
@Autowired
DashboardCachingServiceBeanFactory dashboardCachingServiceBeanFactory

@Value('${gate.installation.mode}')
GateInstallationModes gateInstallationMode

@ApiOperation(value = "Endpoint for dashboard rest services")
@RequestMapping(value = "/{version}/{type}", method = RequestMethod.GET)
Object getDashboardResponse1(@PathVariable("version") String version,
Expand Down Expand Up @@ -248,8 +251,10 @@ class OpsmxDashboardController {
@PathVariable("source3") String source3,
@PathVariable("source4") String source4,
HttpServletRequest request) {
String cookie = request.getHeader("Cookie")

String cookie = "no-cookie"
if(gateInstallationMode.equals(GateInstallationModes.common)){
cookie = request.getHeader("Cookie")
}
return opsmxDashboardService.deleteDashboardResponse7(version, type, source, source1, source2, source3, source4, cookie)
}

Expand Down Expand Up @@ -293,7 +298,10 @@ class OpsmxDashboardController {
@PathVariable("source1") String source1,
@RequestBody(required = false) Object data,
HttpServletRequest request) {
String cookie = request.getHeader("Cookie")
String cookie = "no-cookie"
if(gateInstallationMode.equals(GateInstallationModes.common)){
cookie = request.getHeader("Cookie")
}
return opsmxDashboardService.postDashboardResponse4(version, type, source, source1, cookie, data)
}

Expand Down Expand Up @@ -390,7 +398,10 @@ class OpsmxDashboardController {
@PathVariable("source2") String source2,
@RequestBody(required = false) Object data,
HttpServletRequest request) {
String cookie = request.getHeader("Cookie")
String cookie = "no-cookie"
if(gateInstallationMode != null && gateInstallationMode.equals(GateInstallationModes.common)){
cookie = request.getHeader("Cookie")
}

return opsmxDashboardService.updateDashboardResponse3(version, type, source, source1, source2, data, cookie)
}
Expand Down

0 comments on commit 69b392f

Please sign in to comment.