I have the below piece of code which is not working, but once I'm removing the if condition it returns the expected result
import groovy.json.JsonSlurper
def Imageslist = []
def arr = []
def sout = new StringBuilder(), serr = new StringBuilder()
def b = new StringBuffer()
def number=1
if (number>0){
def command = [ 'bash', '-c', "curl --silent -X GET -H 'Accept: application/vnd.docker.distribution.manifest.v2+json' -u user:pass http://XXXXX:XXXX/v2/_catalog" ]}
def proc = command.execute()
proc.consumeProcessErrorStream(b)
arr=proc.in.text
The current code returns me null, but if I'll remove the if condition, I'll get the required result.
Aucun commentaire:
Enregistrer un commentaire