]> git.proxmox.com Git - pve-container.git/commitdiff
setup: fix using non-plugin methods
authorThomas Lamprecht <t.lamprecht@proxmox.com>
Sat, 19 Nov 2022 17:12:29 +0000 (18:12 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Sat, 19 Nov 2022 17:12:36 +0000 (18:12 +0100)
ct_is_symlink and ct_readlink_recursive are not defined in
PVE::LXC::Setup::Plugin and thus not available for call in
PVE::LXC::Setup, thus it broke unmanaged CTs which does not descends
from the Base module, put from the abstract Plugin directly to avoid
touching its CTs at all (well, it's unmanaged)

We'd either need to add those symlink helpers to the abstract plugin
or, like we do now, add a new more general get_ct_init_path which
unmanaged can truthfully implement.

Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
src/PVE/LXC/Setup.pm
src/PVE/LXC/Setup/Base.pm
src/PVE/LXC/Setup/Plugin.pm
src/PVE/LXC/Setup/Unmanaged.pm

index e5c9ab82f27a6c7367c3a6bb28458b9dddc16ce9..891231f0dce666ef9544109def253d0d42a8422b 100644 (file)
@@ -340,11 +340,7 @@ sub get_ct_init_path {
     my ($self) = @_;
 
     my $init = $self->protected_call(sub {
-       my $init_path = "/sbin/init";
-       if ($self->{plugin}->ct_is_symlink($init_path)) {
-           $init_path = $self->{plugin}->ct_readlink_recursive($init_path);
-       }
-       return $init_path;
+       return $self->{plugin}->get_ct_init_path();
     });
 
     return $init;
index 63d7d700f785a1fda93b9b564e10c0f92a2e77db..547abdb9ae7c32052443e2711e159878d2cef6b6 100644 (file)
@@ -553,6 +553,16 @@ sub unified_cgroupv2_support {
     return 1;
 }
 
+sub get_ct_init_path {
+    my ($self) = @_;
+
+    my $init_path = "/sbin/init";
+    if ($self->ct_is_symlink($init_path)) {
+       $init_path = $self->ct_readlink_recursive($init_path);
+    }
+    return $init_path;
+}
+
 sub ssh_host_key_types_to_generate {
     my ($self) = @_;
 
index 7024856e27dcb8ed72ecbc4e754900da46c09345..3d968e77e37c9f698ecdbf656807c8cb7ed7b675 100644 (file)
@@ -52,6 +52,11 @@ sub unified_cgroupv2_support {
     croak "implement me in sub-class\n";
 }
 
+sub get_ct_init_path {
+    my ($self) = @_;
+    croak "implement me in sub-class\n";
+}
+
 sub ssh_host_key_types_to_generate {
     my ($self) = @_;
     croak "implement me in sub-class\n";
index 280af04fccdb156d55ffdcead248269c2e4dad37..d76921ea0c105afbc34311fb36cdd79ce6e44ea9 100644 (file)
@@ -49,6 +49,11 @@ sub unified_cgroupv2_support {
     return 1; # faking it won't normally hurt ;-)
 }
 
+sub get_ct_init_path {
+    my ($self) = @_;
+    return '/sbin/init'; # only passed to unified_cgroupv2_support for now
+}
+
 sub ssh_host_key_types_to_generate {
     my ($self) = @_;
     return;