-
Notifications
You must be signed in to change notification settings - Fork 68
initial attempt to ensure that product is properly selected when needed #2570
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 3 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
4758096
initial attempt to ensure that product is properly selected when needed
jreidinger 0e25c22
changes
jreidinger 294ba05
Merge branch 'master' into product_fix
jreidinger a2a64f3
Apply suggestions from code review
jreidinger 22314bb
changes from review
jreidinger 96d0b1c
Merge branch 'master' into product_fix
jreidinger File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -30,7 +30,7 @@ use crate::{ | |
| localization::{LocalizationStore, LocalizationStoreError}, | ||
| manager::{http_client::ManagerHTTPClientError, InstallationPhase, ManagerHTTPClient}, | ||
| network::{NetworkStore, NetworkStoreError}, | ||
| product::{ProductStore, ProductStoreError}, | ||
| product::{ProductHTTPClient, ProductStore, ProductStoreError}, | ||
| scripts::{ScriptsClient, ScriptsClientError, ScriptsGroup, ScriptsStore, ScriptsStoreError}, | ||
| security::store::{SecurityStore, SecurityStoreError}, | ||
| software::{SoftwareStore, SoftwareStoreError}, | ||
|
|
@@ -85,6 +85,8 @@ pub enum StoreError { | |
| ZFCP(#[from] ZFCPStoreError), | ||
| #[error("Could not calculate the context")] | ||
| InvalidStoreContext, | ||
| #[error("Cannot proceed with profile without specified product")] | ||
| ProductMissing, | ||
| } | ||
|
|
||
| /// Struct that loads/stores the settings from/to the D-Bus services. | ||
|
|
@@ -177,15 +179,6 @@ impl Store { | |
| } | ||
| } | ||
|
|
||
| if let Some(files) = &settings.files { | ||
| self.files.store(files).await?; | ||
| } | ||
|
|
||
| // import the users (esp. the root password) before initializing software, | ||
| // if software fails the Web UI would be stuck in the root password dialog | ||
| if let Some(user) = &settings.user { | ||
| self.users.store(user).await?; | ||
| } | ||
| if let Some(network) = &settings.network { | ||
| self.network.store(network).await?; | ||
| } | ||
|
|
@@ -199,40 +192,67 @@ impl Store { | |
| if let Some(product) = &settings.product { | ||
| self.product.store(product).await?; | ||
| } | ||
| // here detect if product is properly selected, so later it can be checked | ||
| let is_product_selected = self.detect_selected_product().await?; | ||
| // ordering: localization after product as some product may miss some locales | ||
| if let Some(localization) = &settings.localization { | ||
| Store::check_selected_product(is_product_selected)?; | ||
| self.localization.store(localization).await?; | ||
| } | ||
| // import the users (esp. the root password) before initializing software, | ||
| // if software fails the Web UI would be stuck in the root password dialog | ||
| if let Some(user) = &settings.user { | ||
| Store::check_selected_product(is_product_selected)?; | ||
| self.users.store(user).await?; | ||
| } | ||
| if let Some(software) = &settings.software { | ||
| Store::check_selected_product(is_product_selected)?; | ||
| self.software.store(software).await?; | ||
| } | ||
| let mut dirty_flag_set = false; | ||
| // iscsi has to be done before storage | ||
| if let Some(iscsi) = &settings.iscsi { | ||
| Store::check_selected_product(is_product_selected)?; | ||
| dirty_flag_set = true; | ||
| self.iscsi_client.set_config(iscsi).await? | ||
| } | ||
| // dasd devices has to be activated before storage | ||
| if let Some(dasd) = &settings.dasd { | ||
| Store::check_selected_product(is_product_selected)?; | ||
| dirty_flag_set = true; | ||
| self.dasd.store(dasd).await? | ||
| } | ||
| // zfcp devices has to be activated before storage | ||
| if let Some(zfcp) = &settings.zfcp { | ||
| Store::check_selected_product(is_product_selected)?; | ||
| dirty_flag_set = true; | ||
| self.zfcp.store(zfcp).await? | ||
| } | ||
| // Reprobing storage is not directly done by zFCP, DASD or iSCSI services for a matter of | ||
| // efficiency. For now, clients are expected to explicitly reprobe. It is important to | ||
| // reprobe here before loading the storage settings. Otherwise, the new storage devices are | ||
| // not used. | ||
| self.reprobe_storage().await?; | ||
| if dirty_flag_set { | ||
| Store::check_selected_product(is_product_selected)?; | ||
| self.reprobe_storage().await?; | ||
| } | ||
|
|
||
| if settings.storage.is_some() || settings.storage_autoyast.is_some() { | ||
| Store::check_selected_product(is_product_selected)?; | ||
| self.storage.store(&settings.into()).await? | ||
| } | ||
| if let Some(bootloader) = &settings.bootloader { | ||
| Store::check_selected_product(is_product_selected)?; | ||
| self.bootloader.store(bootloader).await?; | ||
| } | ||
| if let Some(hostname) = &settings.hostname { | ||
| Store::check_selected_product(is_product_selected)?; | ||
| self.hostname.store(hostname).await?; | ||
| } | ||
| if let Some(files) = &settings.files { | ||
| Store::check_selected_product(is_product_selected)?; | ||
| self.files.store(files).await?; | ||
| } | ||
|
|
||
| Ok(()) | ||
| } | ||
|
|
@@ -246,6 +266,20 @@ impl Store { | |
| Ok(()) | ||
| } | ||
|
|
||
| async fn detect_selected_product(&self) -> Result<bool, ProductStoreError> { | ||
| let product_client = ProductHTTPClient::new(self.http_client.clone()); | ||
| let product = product_client.product().await?; | ||
| Ok(!product.is_empty()) | ||
| } | ||
|
|
||
| fn check_selected_product(selected: bool) -> Result<(), StoreError> { | ||
|
||
| if selected { | ||
| Ok(()) | ||
| } else { | ||
| Err(StoreError::ProductMissing) | ||
| } | ||
| } | ||
|
|
||
| /// Runs the pre-installation scripts and forces a probe if the installation phase is "config". | ||
| async fn run_pre_scripts(&self) -> Result<(), StoreError> { | ||
| let scripts_client = ScriptsClient::new(self.http_client.clone()); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,10 @@ | ||
| ------------------------------------------------------------------- | ||
| Wed Jul 16 19:05:48 UTC 2025 - Josef Reidinger <[email protected]> | ||
|
|
||
| - Fix crash when agama profile contain only zfcp section by | ||
jreidinger marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| providing better error report when product selection have to be | ||
| done before or in same profile (bsc#1246601) | ||
jreidinger marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| ------------------------------------------------------------------- | ||
| Wed Jul 16 14:55:00 UTC 2025 - Clemens Famulla-Conrad <[email protected]> | ||
|
|
||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
np:
MissingProduct(asInvalidStoreContext,MissingDevice, etc.).