diff --git a/src/ansible.rs b/src/ansible.rs index 9d3cde96..a64bc338 100644 --- a/src/ansible.rs +++ b/src/ansible.rs @@ -84,14 +84,14 @@ impl AnsibleRunner { // It takes a PathBuf as an argument which represents the inventory path. // It returns a Result containing a vector of tuples. Each tuple contains a string representing the name and the ansible host. // - // Set retry_count to re-run the ansible runner if the inventory list is empty + // Set re_attempt to re-run the ansible runner if the inventory list is empty pub async fn inventory_list( &self, inventory_path: PathBuf, - retry_count: Option, + re_attempt: bool, ) -> Result> { // Run the external command and store the output. - let retry_count = retry_count.unwrap_or(0); + let retry_count = if re_attempt { 3 } else { 0 }; let mut count = 0; let mut inventory = Vec::new(); diff --git a/src/deploy.rs b/src/deploy.rs index 9e0e099d..b21e388b 100644 --- a/src/deploy.rs +++ b/src/deploy.rs @@ -135,7 +135,7 @@ impl DeployCmd { .inventory_list( PathBuf::from("inventory") .join(format!(".{}_build_inventory_digital_ocean.yml", self.name)), - Some(3), + true, ) .await?; let build_ip = build_inventory[0].1; @@ -167,7 +167,7 @@ impl DeployCmd { ".{}_genesis_inventory_digital_ocean.yml", self.name )), - None, + false, ) .await?; let genesis_ip = genesis_inventory[0].1; diff --git a/src/lib.rs b/src/lib.rs index f91244c5..ea499d42 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -423,7 +423,7 @@ impl TestnetDeploy { .inventory_list( PathBuf::from("inventory") .join(format!(".{name}_genesis_inventory_digital_ocean.yml")), - None, + false, ) .await?; let genesis_ip = genesis_inventory[0].1; @@ -486,15 +486,15 @@ impl TestnetDeploy { let genesis_inventory = self .ansible_runner - .inventory_list(genesis_inventory_path, None) + .inventory_list(genesis_inventory_path, false) .await?; let build_inventory = self .ansible_runner - .inventory_list(build_inventory_path, None) + .inventory_list(build_inventory_path, false) .await?; let remaining_nodes_inventory = self .ansible_runner - .inventory_list(remaining_nodes_inventory_path, None) + .inventory_list(remaining_nodes_inventory_path, false) .await?; // It also seems to be possible for a workspace and inventory files to still exist, but diff --git a/src/logs.rs b/src/logs.rs index cf4bd5e9..89b0d24d 100644 --- a/src/logs.rs +++ b/src/logs.rs @@ -248,11 +248,11 @@ impl TestnetDeploy { // Get the inventory of all the nodes let mut all_node_inventory = self .ansible_runner - .inventory_list(genesis_inventory_path, None) + .inventory_list(genesis_inventory_path, false) .await?; all_node_inventory.extend( self.ansible_runner - .inventory_list(remaining_nodes_inventory_path, None) + .inventory_list(remaining_nodes_inventory_path, false) .await?, ); Ok(all_node_inventory) diff --git a/src/logstash.rs b/src/logstash.rs index 7d20a639..a834fdfc 100644 --- a/src/logstash.rs +++ b/src/logstash.rs @@ -226,7 +226,7 @@ impl LogstashDeploy { .inventory_list( PathBuf::from("inventory") .join(format!(".{name}_logstash_inventory_digital_ocean.yml")), - None, + false, ) .await?; let logstash_ip = logstash_inventory[0].1;