Skip to content

Commit

Permalink
fix: rename correctly parameter map retrieved from keptn init #96 (#97)
Browse files Browse the repository at this point in the history
Signed-off-by: Paolo Chila <[email protected]>
  • Loading branch information
pchila authored Feb 18, 2022
1 parent 1194793 commit c1596b2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/sh/keptn/Keptn.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -219,18 +219,18 @@ def keptnConfigureMonitoring(Map args) {

def keptnInit = keptnLoadFromInit(args)

String monitoring = keptnEnrichedArgs.containsKey("monitoring") ? args.monitoring : ""
String monitoring = keptnInit.containsKey("monitoring") ? args.monitoring : ""

if (!monitoring?.trim()) {
error("keptnConfigureMonitoring needs a 'monitoring' argument specifying the desired type of monitoring (e.g., dynatrace, prometheus)")
}

if ((!keptnEnrichedArgs.project?.trim()) || (!keptnEnrichedArgs.service?.trim()) ||
(!keptnEnrichedArgs.keptn_endpoint?.trim()) || (!keptnEnrichedArgs.keptn_api_token?.trim())) {
if ((!keptnInit.project?.trim()) || (!keptnInit.service?.trim()) ||
(!keptnInit.keptn_endpoint?.trim()) || (!keptnInit.keptn_api_token?.trim())) {
error("keptnConfigureMonitoring requires project, service, keptn_endpoint and keptn_api_token to be set. It seems that keptnInit() was not called!")
}

configureMonitoring(monitoring, keptnEnrichedArgs.project, keptnEnrichedArgs.service, keptnEnrichedArgs.keptn_api_token, keptnEnrichedArgs.keptn_endpoint)
configureMonitoring(monitoring, keptnInit.project, keptnInit.service, keptnInit.keptn_api_token, keptnInit.keptn_endpoint)
}

private void configureMonitoring(String monitoring, String project, String service, String keptn_api_token, String keptn_endpoint) {
Expand Down

0 comments on commit c1596b2

Please sign in to comment.