@@ -126,17 +126,20 @@ func jsonRegionsToXmlRegions(regions Regions) []ggr.Region {
126126 for hostPattern , host := range region {
127127 hostNames := parseHostPattern (hostPattern )
128128 for _ , hostName := range hostNames {
129- h := ggr.Host {
130- Name : hostName ,
131- Port : host .Port ,
132- Count : host .Count ,
133- Username : host .Username ,
134- Password : host .Password ,
129+ ports := getPorts (host .Port , host .Ports )
130+ for _ , port := range ports {
131+ h := ggr.Host {
132+ Name : hostName ,
133+ Port : port ,
134+ Count : host .Count ,
135+ Username : host .Username ,
136+ Password : host .Password ,
137+ }
138+ if host .VNC != "" {
139+ h .VNC = preProcessVNC (hostName , port , host .VNC )
140+ }
141+ xmlHosts = append (xmlHosts , h )
135142 }
136- if host .VNC != "" {
137- h .VNC = preProcessVNC (hostName , host .Port , host .VNC )
138- }
139- xmlHosts = append (xmlHosts , h )
140143 }
141144 }
142145 xmlRegions = append (xmlRegions , ggr.Region {
@@ -147,6 +150,19 @@ func jsonRegionsToXmlRegions(regions Regions) []ggr.Region {
147150 return xmlRegions
148151}
149152
153+ func getPorts (port int , ports string ) []int {
154+ if ports != "" {
155+ var ret []int
156+ for _ , maybePort := range parseHostPattern (ports ) {
157+ if port , err := strconv .Atoi (maybePort ); err == nil {
158+ ret = append (ret , port )
159+ }
160+ }
161+ return ret
162+ }
163+ return []int {port }
164+ }
165+
150166func preProcessVNC (hostName string , port int , vnc string ) string {
151167 const selenoid = "selenoid"
152168 const hostPattern = "$hostName"
0 commit comments