Skip to content

Commit 5688462

Browse files
Nabil-Salahashraffouda
authored andcommitted
fix: use hub urls instead of flist urls
Signed-off-by: nabil salah <nabil.salah203@gmail.com>
1 parent ef41178 commit 5688462

2 files changed

Lines changed: 7 additions & 24 deletions

File tree

bootstrap/bootstrap/src/hub.rs

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@ use serde_json;
88
use std::fs::{write, OpenOptions};
99
use std::io::copy;
1010
use std::path::Path;
11-
use url::Url;
1211

1312
#[derive(Deserialize)]
1413
struct ZosConfig {
15-
flist_url: Vec<String>,
14+
hub_url: Vec<String>,
1615
}
1716

1817
fn 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
}

cmds/modules/provisiond/swagger/zos-api.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ components:
377377
flist:
378378
type: string
379379
hub_url:
380-
type: string
380+
type: array
381381
env:
382382
type: object
383383
additionalProperties:

0 commit comments

Comments
 (0)