[pve-devel] [RFC container 1/2] Setup::Base: more generic ct_modify_file function

Dietmar Maurer dietmar at proxmox.com
Sat Feb 27 11:08:30 CET 2016


> Replaced ct_modify_file_head_portion() with ct_modify_file()
> taking a header and and replacing the section in-place
> rather than always moving it to the top of the file.
> 
> The behavior for when a section is not defined can be
> defined via the provided options (replace, prepend, or
> append).

I like the idea, but I would prefer to use always the
same BEGIN/END marks.

> +# Optionally if the file becomes empty it will be deleted.
> +sub ct_modify_file {
> +    my ($self, $file, $header, $data, %options) = @_;
> +
> +    my $head = "# --- BEGIN PVE $header ---\n";
> +    my $tail = "# --- END PVE $header ---\n";

sub ct_modify_file {
   my ($self, $file, $data, %options) = @_;

   my $head = "# --- PCT BEGIN ---\n";
   my $tail = "# --- PCT END ---\n";

and maybe an additional mark to avoid modifications: "# --- PCT SKIP ---\n"

Or why do you want that $header? I am just afraid to write the
documentation for all those different headers ;-)




More information about the pve-devel mailing list