2017-11-13 3 views
0

클라우드 파운드리에 외부 종속성 서비스를 작성하는 스크립트를 작성하려고하는데 스크립트가 성공적으로 실행되지만 웹 패널에 IP가 표시되지 않습니다. 심지어 내가 응용 프로그램과 서비스를 바인딩하면 나열된 IP도 허용하지 않습니다. 하지만 웹 패널에서 외부 종속성을 구성하면 IP의 모든 항목을 볼 수 있으며 나열된 IP를 허용합니다. CLI를 사용하여 IP 목록이있는 외부 종속성 서비스를 만드는 경우 구현시 문제가 있음을 지적하십시오.외부 종속성 클라우드 파운드리 CLI가 작동하지 않습니다.

cf create-service external-dependency-service unstructured myservice -c dependency.json >> G:\Logs 

dependency.json

{ 
"dependencyAsJson" : { 
    "description" : "Testing External Dependency", 
    "destinations" : [ 
    { 
     "address" : "192.168.1.1", 
     "protocol" : "tcp", 
     "portStart" : 1, 
     "portEnd" : 100 
    }, 
    { 
     "address" : "192.168.1.2", 
     "protocol" : "tcp", 
     "portStart" : 1, 
     "portEnd" : 100 
    } 
    ] 
} 
} 

당신은 CLI 명령의 성공적인 실행을 확인하기 위해 로그를 볼 수 있습니다. 다음 명령을 사용하여 추적을 활성화

cf config --trace=true 

답변

0
당신이 사용하는 경우 JSON 개체의 형식은 큰 따옴표

cf create-service external-dependency-service unstructured myservice -c dependency.json >> G:\Logs 

{"dependencyAsJson" : {\"description\" : \"Testing External Dependency\",\"destinations\" : [{\"address\" : \"192.168.1.1\",\"protocol\" : \"tcp\",\"portStart\" : 1,\"portEnd\" : 100},{\"address\" : \"192.168.1.2\",\"protocol\":\"tcp\",\"portStart\" : 1,\"portEnd\" : 100}]}} 

사이에 줄 바꿈과 공백없이 한 줄에, 이스케이프 문자열을 특정 형식이어야합니다

그것을 java 문자열 안에 넣으면 형식을 유지하기 위해 \\를 사용해야합니다.

{"dependencyAsJson" : {\\\"description\\\" : \\\"Testing External Dependency\\\",\\\"destinations\\\" : [{\\\"address\\\" : \\\"192.168.1.1\\\",\\\"protocol\\\" : \\\"tcp\\\",\\\"portStart\\\" : 1,\\\"portEnd\\\" : 100},{\\\"address\\\" : \\\"192.168.1.2\\\",\\\"protocol\\\":\\\"tcp\\\",\\\"portStart\\\" : 1,\\\"portEnd\\\" : 100}]}} 
관련 문제