From: Thomas Lamprecht <t.lamprecht@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] applied: [PATCH installer] auto-install: rename 'posthook' to 'post-installation-webhook'
Date: Thu, 14 Nov 2024 21:56:52 +0100 [thread overview]
Message-ID: <20241114205652.3522223-1-t.lamprecht@proxmox.com> (raw)
Webhooks are nowadays pretty clear in what they do generally, so the
updated name should paint a clearer picture about what this is about
and avoid confusion with a under-development feature that executes a
admin provided program after the installation on the target system,
which could be also seen as "posthook".
Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
---
proxmox-auto-installer/src/answer.rs | 2 +-
proxmox-post-hook/src/main.rs | 22 +++++++++++-----------
2 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/proxmox-auto-installer/src/answer.rs b/proxmox-auto-installer/src/answer.rs
index c23f1f3..73e5869 100644
--- a/proxmox-auto-installer/src/answer.rs
+++ b/proxmox-auto-installer/src/answer.rs
@@ -21,7 +21,7 @@ pub struct Answer {
#[serde(rename = "disk-setup")]
pub disks: Disks,
#[serde(default)]
- pub posthook: Option<PostNotificationHookInfo>,
+ pub post_installation_webhook: Option<PostNotificationHookInfo>,
}
impl Answer {
diff --git a/proxmox-post-hook/src/main.rs b/proxmox-post-hook/src/main.rs
index 198e0c9..ae373d8 100644
--- a/proxmox-post-hook/src/main.rs
+++ b/proxmox-post-hook/src/main.rs
@@ -1,9 +1,9 @@
//! Post installation hook for the Proxmox installer, mainly for combination
//! with the auto-installer.
//!
-//! If a `[posthook]` section is specified in the given answer file, it will
-//! send a HTTP POST request to that URL, with an optional certificate fingerprint
-//! for usage with (self-signed) TLS certificates.
+//! If a `[post-installation-webhook]` section is specified in the given answer file, it will send
+//! a HTTP POST request to that URL, with an optional certificate fingerprint for usage with
+//! (self-signed) TLS certificates.
//! In the body of the request, information about the newly installed system is sent.
//!
//! Relies on `proxmox-chroot` as an external dependency to (bind-)mount the
@@ -155,7 +155,7 @@ impl Default for PostHookInfoMeta {
}
}
-/// All data sent as request payload with the post-hook POST request.
+/// All data sent as request payload with the post-installation-webhook POST request.
///
/// NOTE: The format is versioned through `format_info.version` (`$format-info.version` in the
/// resulting JSON), ensure you update it when this struct or any of its members gets modified.
@@ -616,18 +616,18 @@ fn with_chroot<R, F: FnOnce(&str) -> Result<R>>(callback: F) -> Result<R> {
result
}
-/// Reads the answer file from stdin, checks for a configured post-hook URL (+ optional certificate
-/// fingerprint for HTTPS). If configured, retrieves all relevant information about the installed
-/// system and sends them to the given endpoint.
+/// Reads the answer file from stdin, checks for a configured post-installation-webhook URL (+
+/// optional certificate fingerprint for HTTPS). If configured, retrieves all relevant information
+/// about the installed system and sends them to the given endpoint.
fn do_main() -> Result<()> {
let answer = Answer::try_from_reader(std::io::stdin().lock())?;
if let Some(PostNotificationHookInfo {
url,
cert_fingerprint,
- }) = &answer.posthook
+ }) = &answer.post_installation_webhook
{
- println!("Found posthook; sending POST request to '{url}'.");
+ println!("Found post-installation-webhook; sending POST request to '{url}'.");
let info = with_chroot(|target_path| PostHookInfo::gather(target_path, &answer))?;
@@ -637,7 +637,7 @@ fn do_main() -> Result<()> {
serde_json::to_string(&info)?,
)?;
} else {
- println!("No posthook found; skipping");
+ println!("No post-installation-webhook configured; skipping");
}
Ok(())
@@ -647,7 +647,7 @@ fn main() -> ExitCode {
match do_main() {
Ok(()) => ExitCode::SUCCESS,
Err(err) => {
- eprintln!("\nError occurred during posthook:");
+ eprintln!("\nError occurred during post-installation-webhook:");
eprintln!("{err:#}");
ExitCode::FAILURE
}
--
2.39.5
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
reply other threads:[~2024-11-14 20:57 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241114205652.3522223-1-t.lamprecht@proxmox.com \
--to=t.lamprecht@proxmox.com \
--cc=pve-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox