Skip to content

Commit

Permalink
Do not check the installer phase in the CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
teclator committed Feb 5, 2025
1 parent be6a622 commit 00bb8e2
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 12 deletions.
10 changes: 5 additions & 5 deletions rust/agama-cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,12 +142,12 @@ async fn reboot(manager: &ManagerClient<'_>) -> anyhow::Result<()> {

// Make sure that the manager is ready
manager.wait().await?;

let phase = manager.current_installation_phase().await?;
match phase {
agama_lib::manager::InstallationPhase::Finish => Ok(manager.finish().await?),
_ => Err(CliError::NotFinished)?,
let finished = manager.finish().await?;
if !manager.finish().await? {
eprintln!("Cannot reboot the system");
return Err(CliError::NotFinished)?;
}
Ok(())
}

async fn show_progress() -> Result<(), ServiceError> {
Expand Down
2 changes: 1 addition & 1 deletion rust/agama-lib/src/manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ impl<'a> ManagerClient<'a> {
}

/// Executes the after installation tasks.
pub async fn finish(&self) -> Result<(), ServiceError> {
pub async fn finish(&self) -> Result<bool, ServiceError> {
Ok(self.manager_proxy.finish().await?)
}

Expand Down
2 changes: 1 addition & 1 deletion rust/agama-lib/src/proxies/manager1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub trait Manager1 {
fn commit(&self) -> zbus::Result<()>;

/// Finish method
fn finish(&self) -> zbus::Result<()>;
fn finish(&self) -> zbus::Result<bool>;

/// Probe method
fn probe(&self) -> zbus::Result<()>;
Expand Down
5 changes: 2 additions & 3 deletions rust/agama-server/src/manager/web.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,8 @@ async fn install_action(State(state): State<ManagerState<'_>>) -> Result<(), Err
(status = 200, description = "The installation tasks are executed.")
)
)]
async fn finish_action(State(state): State<ManagerState<'_>>) -> Result<(), Error> {
state.manager.finish().await?;
Ok(())
async fn finish_action(State(state): State<ManagerState<'_>>) -> Result<Json<bool>, Error> {
Ok(Json(state.manager.finish().await?))
}

/// Returns the manager status.
Expand Down
4 changes: 3 additions & 1 deletion service/lib/agama/dbus/manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ def initialize(backend, logger)
dbus_method(:Commit, "") { install_phase }
dbus_method(:CanInstall, "out result:b") { can_install? }
dbus_method(:CollectLogs, "out tarball_filesystem_path:s") { collect_logs }
dbus_method(:Finish, "") { finish_phase }
dbus_method(:Finish, "out result:b") { finish_phase }
dbus_reader :installation_phases, "aa{sv}"
dbus_reader :current_installation_phase, "u"
dbus_reader :iguana_backend, "b"
Expand Down Expand Up @@ -101,6 +101,8 @@ def collect_logs
end

# Last action for the installer
#
# @return [Boolean]
def finish_phase
backend.finish_installation
end
Expand Down
4 changes: 3 additions & 1 deletion service/lib/agama/manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@ def collect_logs(path: nil)
end

# Whatever has to be done at the end of installation
#
# @return [Boolean]
def finish_installation
logs = collect_logs(path: "/tmp/var/logs/")

Expand All @@ -267,7 +269,7 @@ def finish_installation

logger.info("Finishing installation with #{cmd}")

system(cmd)
!!system(cmd)
end

# Says whether running on iguana or not
Expand Down

0 comments on commit 00bb8e2

Please sign in to comment.