@@ -8,11 +8,10 @@ use serde_json;
88use std:: fs:: { write, OpenOptions } ;
99use std:: io:: copy;
1010use std:: path:: Path ;
11- use url:: Url ;
1211
1312#[ derive( Deserialize ) ]
1413struct ZosConfig {
15- flist_url : Vec < String > ,
14+ hub_url : Vec < String > ,
1615}
1716
1817fn get_hub_url ( runmode : & RunMode ) -> Result < Vec < String > > {
@@ -27,13 +26,14 @@ fn get_hub_url(runmode: &RunMode) -> Result<Vec<String>> {
2726 let config_url = format ! ( "{}/{}" , base_url, config_filename) ;
2827 let fallback = vec ! [ "https://hub.grid.tf" . to_string( ) ] ;
2928
30- let final_url = retry ( Exponential :: from_millis ( 1000 ) . take ( 5 ) , || {
29+ let hub_urls = retry ( Exponential :: from_millis ( 1000 ) . take ( 5 ) , || {
3130 match get ( config_url. as_str ( ) ) {
3231 Ok ( resp) if resp. status ( ) . is_success ( ) => OperationResult :: Ok ( resp) ,
3332 Ok ( _) | Err ( _) => OperationResult :: Retry ( "Retrying..." ) ,
3433 }
3534 } ) ;
36- let response = match final_url {
35+
36+ let response = match hub_urls {
3737 Ok ( resp) => resp,
3838 Err ( _) => return Ok ( fallback) ,
3939 } ;
@@ -43,26 +43,10 @@ fn get_hub_url(runmode: &RunMode) -> Result<Vec<String>> {
4343 Err ( _) => return Ok ( fallback) ,
4444 } ;
4545
46- let mut hub_urls = Vec :: new ( ) ;
47-
48- for flist_url in config. flist_url {
49- let hub_url = if let Ok ( parsed) = Url :: parse ( & flist_url) {
50- if let Some ( host) = parsed. host_str ( ) {
51- format ! ( "https://{}" , host)
52- } else {
53- continue ;
54- }
55- } else {
56- continue ;
57- } ;
58-
59- hub_urls. push ( hub_url) ;
60- }
61-
62- if hub_urls. is_empty ( ) {
46+ if config. hub_url . is_empty ( ) {
6347 Ok ( fallback)
6448 } else {
65- Ok ( hub_urls )
49+ Ok ( config . hub_url )
6650 }
6751}
6852
@@ -112,7 +96,6 @@ impl Repo {
11296 /// Helper function to find the first working hub URL
11397 fn get_working_hub ( & self ) -> & String {
11498 for hub_url in & self . hub {
115- // Try to ping the hub with a simple API call
11699 if self . is_hub_working ( hub_url) {
117100 return hub_url;
118101 }
0 commit comments