public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [pve-devel] [PATCH manager 1/1] vzdump: check that notes-template is a single line
@ 2022-04-28  8:07 Fabian Ebner
  2022-04-28  8:07 ` [pve-devel] [PATCH guest-common 1/1] vzdump: update notes-template description Fabian Ebner
  2022-04-28  8:07 ` [pve-devel] [PATCH docs 1/1] vzdump: add section for notes and notes-template Fabian Ebner
  0 siblings, 2 replies; 3+ messages in thread
From: Fabian Ebner @ 2022-04-28  8:07 UTC (permalink / raw)
  To: pve-devel

While vzdump itself wouldn't mind about unescaped newlines, the
parameter isn't supposed to contain any, and when used as part of the
job config, it has to be a single line too, so make it consistent.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---

These are follow-ups for the "add protected and notes-template
parameters for vzdump" series.

 PVE/VZDump.pm | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/PVE/VZDump.pm b/PVE/VZDump.pm
index fcbd87d5..80cbddb5 100644
--- a/PVE/VZDump.pm
+++ b/PVE/VZDump.pm
@@ -1326,6 +1326,9 @@ sub verify_vzdump_parameters {
 
     $parse_prune_backups_maxfiles->($param, 'CLI parameters');
 
+    raise_param_exc({'notes-template' => "contains a line feed"})
+	if $param->{'notes-template'} && $param->{'notes-template'} =~ m/\n/;
+
     $param->{all} = 1 if (defined($param->{exclude}) && !$param->{pool});
 
     return if !$check_missing;
-- 
2.30.2





^ permalink raw reply	[flat|nested] 3+ messages in thread

* [pve-devel] [PATCH guest-common 1/1] vzdump: update notes-template description
  2022-04-28  8:07 [pve-devel] [PATCH manager 1/1] vzdump: check that notes-template is a single line Fabian Ebner
@ 2022-04-28  8:07 ` Fabian Ebner
  2022-04-28  8:07 ` [pve-devel] [PATCH docs 1/1] vzdump: add section for notes and notes-template Fabian Ebner
  1 sibling, 0 replies; 3+ messages in thread
From: Fabian Ebner @ 2022-04-28  8:07 UTC (permalink / raw)
  To: pve-devel

as the actual handling in pve-manager changed a bit.

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
 src/PVE/VZDump/Common.pm | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/PVE/VZDump/Common.pm b/src/PVE/VZDump/Common.pm
index d8c78c4..72337cb 100644
--- a/src/PVE/VZDump/Common.pm
+++ b/src/PVE/VZDump/Common.pm
@@ -239,7 +239,8 @@ my $confdesc = {
 	description => "Template string for generating notes for the backup(s). It can contain ".
 	    "variables which will be replaced by their values. Currently supported are ".
 	    "{{cluster}}, {{guestname}}, {{node}}, and {{vmid}}, but more might be added in the ".
-	    "future.",
+	    "future. Needs to be a single line, newline and backslash need to be escaped as '\\n' ".
+	    "and '\\\\' respectively.",
 	requires => 'storage',
 	optional => 1,
     },
-- 
2.30.2





^ permalink raw reply	[flat|nested] 3+ messages in thread

* [pve-devel] [PATCH docs 1/1] vzdump: add section for notes and notes-template
  2022-04-28  8:07 [pve-devel] [PATCH manager 1/1] vzdump: check that notes-template is a single line Fabian Ebner
  2022-04-28  8:07 ` [pve-devel] [PATCH guest-common 1/1] vzdump: update notes-template description Fabian Ebner
@ 2022-04-28  8:07 ` Fabian Ebner
  1 sibling, 0 replies; 3+ messages in thread
From: Fabian Ebner @ 2022-04-28  8:07 UTC (permalink / raw)
  To: pve-devel

Signed-off-by: Fabian Ebner <f.ebner@proxmox.com>
---
 vzdump.adoc | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/vzdump.adoc b/vzdump.adoc
index 093f639..5a13d3a 100644
--- a/vzdump.adoc
+++ b/vzdump.adoc
@@ -306,6 +306,19 @@ backups per guest are allowed on the storage. Use `-1` for unlimited. The
 default is unlimited for users with `Datastore.Allocate` privilege and `5` for
 other users.
 
+[[vzdump_notes]]
+Backup Notes
+------------
+
+You can add notes to backups using the 'Edit Notes' button in the UI or via the
+storage content API. It is also possible to specify a template for generating
+notes dynamically for a backup job and for manual backup. The template string
+can contain variables, surrounded by two curly braces, which will be replaced by
+the corresponding value when the backup is executed. Currently supported are
+`{{cluster}}`, `{{guestname}}`, `{{node}}`, and `{{vmid}}`. When specified via
+API or CLI, it needs to be a single line, where newline and backslash need to be
+escaped as `\n` and `\\` respectively.
+
 [[vzdump_restore]]
 Restore
 -------
-- 
2.30.2





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-04-28  8:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-28  8:07 [pve-devel] [PATCH manager 1/1] vzdump: check that notes-template is a single line Fabian Ebner
2022-04-28  8:07 ` [pve-devel] [PATCH guest-common 1/1] vzdump: update notes-template description Fabian Ebner
2022-04-28  8:07 ` [pve-devel] [PATCH docs 1/1] vzdump: add section for notes and notes-template Fabian Ebner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal