xebialabs-community/xld-apigee-plugin

response maybe null with multiple revisions

ltutar opened this issue · 0 comments

after undeploying, asking the revisions may return a null value and this gives an error while printing.
solution: check if the response is null first.

https://github.com/xebialabs-community/xld-apigee-plugin/blob/master/src/main/resources/apigee/upload-api-proxy-and-deploy.py#L49 should be like
https://github.com/xebialabs-community/xld-apigee-plugin/blob/master/src/main/resources/apigee/check-organization-connection.py#L17

`
https://api.enterprise.apigee.com/v1/organizations/tuttifrutti/environments/dev/apis/godspeed-v1/deployments Multi factor authentication is on {u'revision': [{u'server': [{u'pod': {u'name': u'rde1mp250-5', u'region': u'eu-central-1'}, u'type': [u'message-processor'], u'uUID': u'1111-6a72-4848-8652-ccc', u'status': u'deployed'}, {u'pod': {u'name': u'rde1mp250-5', u'region': u'eu-central-1'}, u'type': [u'message-processor'], u'uUID': u'bcf6fbac-1800-4d81-9183-92b80335d549', u'status': u'deployed'}, {u'pod': {u'name': u'rde1rt250-0', u'region': u'eu-central-1'}, u'type': [u'router'], u'uUID': u'bb62a4e8-2247-1111-89a6-5cb406eee0ed', u'status': u'deployed'}, {u'pod': {u'name': u'rde1rt250-0', u'region': u'eu-central-1'}, u'type': [u'router'], u'uUID': u'7ded8d09-8701-4cdd-a586-e64a40d8170b', u'status': u'deployed'}], u'configuration': {u'configVersion': u'SHA-512:1234', u'steps': [], u'basePath': u'/'}, u'name': u'20', u'state': u'deployed'}, {u'server': [{u'pod': {u'name': u'rde1mp250-5', u'region': u'eu-central-1'}, u'type': [u'message-processor'], u'uUID': u'9bd542d3-6a72-4848-8652-ce96a89b5f76', u'status': u'deployed'}, {u'pod': {u'name': u'rde1mp250-5', u'region': u'eu-central-1'}, u'type': [u'message-processor'], u'uUID': u'bcf6fbac-1800-4d81-9183-ccc', u'status': u'deployed'}, {u'pod': {u'name': u'rde1rt250-0', u'region': u'eu-central-1'}, u'type': [u'router'], u'uUID': u'bb62a4e8-2247-4ddf-89a6-ccc', u'status': u'deployed'}, {u'pod': {u'name': u'rde1rt250-0', u'region': u'eu-central-1'}, u'type': [u'router'], u'uUID': u'7ded8d09-8701-4cdd-a586-e64a40d8170b', u'status': u'deployed'}], u'configuration': {u'configVersion': u'SHA-512:1234', u'steps': [], u'basePath': u'/'}, u'name': u'21', u'state': u'deployed'}], u'environment': u'dev', u'organization': u'tuttifrutti', u'name': u'godspeed-v1'} There are multiple revisions of this apiproxy godspeed-v1 deployed to environment dev We will undeploy all of these except our latest deployed revision 21 Undeploying revision number: 20 The URL that is being used to undeploy the API Proxy godspeed-v1/20 from environment dev https://api.enterprise.apigee.com/v1/organizations/tuttifrutti/environments/dev/apis/godspeed-v1/revisions/20/deployments Multi factor authentication is turned on for this Apigee account tuttifrutti Creating the time-based token Multi factor authentication is turned on for this Apigee account tuttifrutti Creating the time-based token Get revision numbers:

https://api.enterprise.apigee.com/v1/organizations/tuttifrutti/environments/dev/apis/godspeed-v1/deployments Multi factor authentication is on [ERROR]: Error while executing script [apigee/upload-api-proxy-and-deploy.py]: ValueError: Extra data: line 47 column 2 - line 47 column 7 (char 1294 - 1299) in <script> at line number 49 [ERROR]: com.xebialabs.platform.script.jython.JythonException: Error while executing script [apigee/upload-api-proxy-and-deploy.py]: ValueError: Extra data: line 47 column 2 - line 47 column 7 (char 1294 - 1299) in <script> at line number 49 [ERROR]: at com.xebialabs.platform.script.jython.JythonException$.apply(JythonException.scala:17) [ERROR]: at com.xebialabs.platform.script.jython.JythonSupport.$anonfun$executeScript$3(JythonSupport.scala:44) [ERROR]: at com.xebialabs.platform.script.jython.JythonSupport.withThreadLocalWriter(JythonSupport.scala:51) [ERROR]: at com.xebialabs.platform.script.jython.JythonSupport.executeScript(JythonSupport.scala:40) [ERROR]: at com.xebialabs.platform.script.jython.JythonSupport.executeScript$(JythonSupport.scala:37) [ERROR]: at com.xebialabs.deployit.plugin.steps.JythonStep$$anon$1.executeScript(JythonStep.scala:27) [ERROR]: at com.xebialabs.platform.script.jython.JythonSupport.executeScript(JythonSupport.scala:34) [ERROR]: at com.xebialabs.platform.script.jython.JythonSupport.executeScript$(JythonSupport.scala:28) [ERROR]: at com.xebialabs.deployit.plugin.steps.JythonStep$$anon$1.executeScript(JythonStep.scala:27) [ERROR]: at com.xebialabs.deployit.plugin.steps.JythonStep.executeScript(JythonStep.scala:66) [ERROR]: at com.xebialabs.deployit.plugin.steps.JythonStep.execute(JythonStep.scala:57) [ERROR]: at com.xebialabs.deployit.engine.tasker.StepExecutingActor.$anonfun$executeStep$2(StepExecutingActor.scala:128) [ERROR]: at com.xebialabs.deployit.engine.tasker.MdcUtils$.withMdc(MdcUtils.scala:16) [ERROR]: at com.xebialabs.deployit.engine.tasker.StepExecutingActor.$anonfun$executeStep$1(StepExecutingActor.scala:118) [ERROR]: at scala.concurrent.Future$.$anonfun$apply$1(Future.scala:653) [ERROR]: at scala.util.Success.$anonfun$map$1(Try.scala:251) [ERROR]: at scala.util.Success.map(Try.scala:209) [ERROR]: at scala.concurrent.Future.$anonfun$map$1(Future.scala:287) [ERROR]: at scala.concurrent.impl.Promise.liftedTree1$1(Promise.scala:29) [ERROR]: at scala.concurrent.impl.Promise.$anonfun$transform$1(Promise.scala:29) [ERROR]: at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:60) [ERROR]: at akka.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:55) [ERROR]: at akka.dispatch.BatchingExecutor$BlockableBatch.$anonfun$run$1(BatchingExecutor.scala:91) [ERROR]: at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12) [ERROR]: at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:81) [ERROR]: at akka.dispatch.BatchingExecutor$BlockableBatch.run(BatchingExecutor.scala:91) [ERROR]: at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:40) [ERROR]: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [ERROR]: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [ERROR]: at java.lang.Thread.run(Thread.java:748) [ERROR]: Caused by: javax.script.ScriptException: ValueError: Extra data: line 47 column 2 - line 47 column 7 (char 1294 - 1299) in <script> at line number 49 [ERROR]: at org.python.jsr223.PyScriptEngine.scriptException(PyScriptEngine.java:222) [ERROR]: at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:59) [ERROR]: at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:31) [ERROR]: at com.xebialabs.platform.script.jython.JythonSupport.$anonfun$executeScript$3(JythonSupport.scala:41) [ERROR]: ... 28 more [ERROR]: Caused by: Traceback (most recent call last): [ERROR]: File "<script>", line 49, in [ERROR]: File "/appl/xldeploy/xl-deploy-7.5.2-server/lib/jython-standalone-2.7.1.patch2609.jar/Lib/json/init$py.class", line 338, in loads [ERROR]: File "/appl/xldeploy/xl-deploy-7.5.2-server/lib/jython-stan
dalone-2.7.1.patch2609.jar/Lib/json/decoder$py.class", line 368, in decode [ERROR]: ValueError: Extra data: line 47 column 2 - line 47 column 7 (char 1294 - 1299) [ERROR]: [ERROR]: at org.python.core.PyException.doRaise(PyException.java:233) [ERROR]: at org.python.core.Py.makeException(Py.java:1565) [ERROR]: at org.python.core.Py.makeException(Py.java:1569) [ERROR]: at org.python.core.Py.makeException(Py.java:1573) [ERROR]: at json.decoder$py.decode$9(/home/ciaby/code/jython/dist/Lib/json/decoder.py:369) [ERROR]: at json.decoder$py.call_function(/home/ciaby/code/jython/dist/Lib/json/decoder.py) [ERROR]: at org.python.core.PyTableCode.call(PyTableCode.java:171) [ERROR]: at org.python.core.PyBaseCode.call(PyBaseCode.java:308) [ERROR]: at org.python.core.PyBaseCode.call(PyBaseCode.java:146) [ERROR]: at org.python.core.PyFunction.call(PyFunction.java:423) [ERROR]: at org.python.core.PyMethod.call(PyMethod.java:141) [ERROR]: at json$py.loads$4(/home/ciaby/code/jython/dist/Lib/json/init.py:351) [ERROR]: at json$py.call_function(/home/ciaby/code/jython/dist/Lib/json/init.py) [ERROR]: at org.python.core.PyTableCode.call(PyTableCode.java:171) [ERROR]: at org.python.core.PyBaseCode.call(PyBaseCode.java:308) [ERROR]: at org.python.core.PyBaseCode.call(PyBaseCode.java:132) [ERROR]: at org.python.core.PyFunction.call(PyFunction.java:413) [ERROR]: at org.python.pycode._pyx56095.f$0(<script>:55) [ERROR]: at org.python.pycode._pyx56095.call_function(<script>) [ERROR]: at org.python.core.PyTableCode.call(PyTableCode.java:171) [ERROR]: at org.python.core.PyCode.call(PyCode.java:18) [ERROR]: at org.python.core.Py.runCode(Py.java:1614) [ERROR]: at org.python.core.builtin.eval(builtin.java:497) [ERROR]: at org.python.core.builtin.eval(builtin.java:501) [ERROR]: at org.python.util.PythonInterpreter.eval(PythonInterpreter.java:259) [ERROR]: at org.python.jsr223.PyScriptEngine.eval(PyScriptEngine.java:57) [ERROR]: ... 30 more
`