From 93d7e54a97e879fa3b3d12825b04d3dd7626fcff Mon Sep 17 00:00:00 2001 From: Ivan Fernandez Calvo Date: Thu, 8 Apr 2021 17:13:42 +0200 Subject: [PATCH] fix: use toJSON instead readJSON --- src/test/groovy/ApmCliStepTests.groovy | 7 ++----- vars/apmCli.groovy | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/test/groovy/ApmCliStepTests.groovy b/src/test/groovy/ApmCliStepTests.groovy index 320d7323d..352c8b2b7 100644 --- a/src/test/groovy/ApmCliStepTests.groovy +++ b/src/test/groovy/ApmCliStepTests.groovy @@ -86,11 +86,8 @@ class ApmCliStepTests extends ApmBasePipelineTest { @Test void testVaultConfig() throws Exception { helper.registerAllowedMethod('getVaultSecret', [Map.class], - { return [ - "data": [ - "value": '{"url": "https://vaultapm.example.com:8200", "token": "vaultApmPassword"}' - ] - ] + { + return [data: [value: '{"url": "https://vaultapm.example.com:8200", "token": "vaultApmPassword"}' ]] }) script.call(apmCliConfig: "secret/oblt/apm", serviceName: "serviceFoo") diff --git a/vars/apmCli.groovy b/vars/apmCli.groovy index eaeed92b3..7f542b061 100644 --- a/vars/apmCli.groovy +++ b/vars/apmCli.groovy @@ -53,7 +53,7 @@ def call(Map args = [:]) { if(!url && !token){ def apmJson = getVaultSecret(secret: "${apmCliConfig}")?.data.value - def apm = readJSON(text: apmJson) + def apm = toJSON(apmJson) url = apm.url token = apm.token }