[pve-devel] [PATCH installer 4/7] tui-installer: adapt to new `root_password` plain/hashed setup option

Christoph Heiss c.heiss at proxmox.com
Thu May 23 14:19:32 CEST 2024


Signed-off-by: Christoph Heiss <c.heiss at proxmox.com>
---
 proxmox-installer-common/src/setup.rs | 12 ++++++++++--
 proxmox-tui-installer/src/setup.rs    | 10 ++++++++--
 2 files changed, 18 insertions(+), 4 deletions(-)

diff --git a/proxmox-installer-common/src/setup.rs b/proxmox-installer-common/src/setup.rs
index 64d05af..ef92eb7 100644
--- a/proxmox-installer-common/src/setup.rs
+++ b/proxmox-installer-common/src/setup.rs
@@ -424,6 +424,14 @@ impl Interface {
     }
 }
 
+#[derive(Clone, Deserialize, Serialize)]
+pub struct InstallRootPassword {
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub plain: Option<String>,
+    #[serde(skip_serializing_if = "Option::is_none")]
+    pub hashed: Option<String>,
+}
+
 pub fn spawn_low_level_installer(test_mode: bool) -> io::Result<process::Child> {
     let (path, args, envs): (&str, &[&str], Vec<(&str, &str)>) = if test_mode {
         (
@@ -444,7 +452,7 @@ pub fn spawn_low_level_installer(test_mode: bool) -> io::Result<process::Child>
 }
 
 /// See Proxmox::Install::Config
-#[derive(Debug, Deserialize, Serialize)]
+#[derive(Deserialize, Serialize)]
 pub struct InstallConfig {
     pub autoreboot: usize,
 
@@ -485,7 +493,7 @@ pub struct InstallConfig {
     pub timezone: String,
     pub keymap: String,
 
-    pub password: String,
+    pub root_password: InstallRootPassword,
     pub mailto: String,
     #[serde(skip_serializing_if = "Vec::is_empty")]
     pub root_ssh_keys: Vec<String>,
diff --git a/proxmox-tui-installer/src/setup.rs b/proxmox-tui-installer/src/setup.rs
index 8c01e42..ee6e65c 100644
--- a/proxmox-tui-installer/src/setup.rs
+++ b/proxmox-tui-installer/src/setup.rs
@@ -1,7 +1,10 @@
 use std::collections::BTreeMap;
 
 use crate::options::InstallerOptions;
-use proxmox_installer_common::{options::AdvancedBootdiskOptions, setup::InstallConfig};
+use proxmox_installer_common::{
+    options::AdvancedBootdiskOptions,
+    setup::{InstallConfig, InstallRootPassword},
+};
 
 impl From<InstallerOptions> for InstallConfig {
     fn from(options: InstallerOptions) -> Self {
@@ -23,7 +26,10 @@ impl From<InstallerOptions> for InstallConfig {
             timezone: options.timezone.timezone,
             keymap: options.timezone.kb_layout,
 
-            password: options.password.root_password,
+            root_password: InstallRootPassword {
+                plain: Some(options.password.root_password),
+                hashed: None,
+            },
             mailto: options.password.email,
             root_ssh_keys: vec![],
 
-- 
2.44.0





More information about the pve-devel mailing list