Skip to content

Commit

Permalink
Revert "fix(rust): postpone running pre-scripts"
Browse files Browse the repository at this point in the history
This reverts commit 73f830f.
  • Loading branch information
imobachgs committed Oct 18, 2024
1 parent f7f2318 commit 1ebaab2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 13 deletions.
14 changes: 2 additions & 12 deletions rust/agama-cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
// To contact SUSE LLC about this file by physical or electronic mail, you may
// find current contact information at www.suse.com.

use agama_lib::scripts::{ScriptsClient, ScriptsGroup};
use clap::{Args, Parser};

mod auth;
Expand Down Expand Up @@ -93,17 +92,8 @@ async fn probe() -> anyhow::Result<()> {
///
/// Before starting, it makes sure that the manager is idle.
///
/// * `client`: base HTTP client.
/// * `manager`: the manager client.
/// * `max_attempts`: number of attempts to start the installation.
async fn install(
client: BaseHTTPClient,
manager: &ManagerClient<'_>,
max_attempts: u8,
) -> anyhow::Result<()> {
let scripts = ScriptsClient::new(client);
scripts.run_scripts(ScriptsGroup::Pre).await?;

async fn install(manager: &ManagerClient<'_>, max_attempts: u8) -> anyhow::Result<()> {
if manager.is_busy().await {
println!("Agama's manager is busy. Waiting until it is ready...");
}
Expand Down Expand Up @@ -219,7 +209,7 @@ pub async fn run_command(cli: Cli) -> Result<(), ServiceError> {
Commands::Profile(subcommand) => run_profile_cmd(subcommand).await?,
Commands::Install => {
let manager = build_manager().await?;
install(client, &manager, 3).await?
install(&manager, 3).await?
}
Commands::Questions(subcommand) => run_questions_cmd(client, subcommand).await?,
// TODO: logs command was originally designed with idea that agama's cli and agama
Expand Down
1 change: 0 additions & 1 deletion rust/agama-lib/src/scripts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ mod model;
mod settings;
mod store;

pub use client::ScriptsClient;
pub use error::ScriptError;
pub use model::*;
pub use settings::*;
Expand Down
2 changes: 2 additions & 0 deletions rust/agama-lib/src/scripts/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ impl ScriptsStore {
.await?;
}

self.client.run_scripts(ScriptsGroup::Pre).await?;

Ok(())
}

Expand Down

0 comments on commit 1ebaab2

Please sign in to comment.