Having the sent post-hook data available somewhere in the installatino
environment after the fact is seful for easily inspecting a
failed/rejected post-hook.

Signed-off-by: Christoph Heiss <[email protected]>
---
It's a rather niche thing and more useful to developers than users.
Added this while working on the PDM integration, and thought it might be
nice to have this in general, especially since it does not have any
other impact.

 proxmox-post-hook/src/main.rs | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/proxmox-post-hook/src/main.rs b/proxmox-post-hook/src/main.rs
index 9989389..a1aee1c 100644
--- a/proxmox-post-hook/src/main.rs
+++ b/proxmox-post-hook/src/main.rs
@@ -662,6 +662,15 @@ fn do_main() -> Result<()> {
 
         let info = with_chroot(|target_path| PostHookInfo::gather(target_path, 
&answer))?;
 
+        if let Err(err) = fs::write(
+            "/run/proxmox-installer/post-hook-data.json",
+            serde_json::to_string_pretty(&info)?,
+        ) {
+            eprintln!(
+                "Failed to write post-installation-webhook data to 
/run/proxmox-installer: {err:#}"
+            );
+        }
+
         proxmox_installer_common::http::post(
             url,
             cert_fingerprint.as_deref(),
-- 
2.51.2



_______________________________________________
pve-devel mailing list
[email protected]
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to