[pve-devel] [PATCH container v2 3/4] update_lxc_config: remove ostype check

Thomas Lamprecht t.lamprecht at proxmox.com
Tue Aug 22 15:43:24 CEST 2017


We have altogether three calls to this method, all in API context with already
sanitizied ostype.

Signed-off-by: Thomas Lamprecht <t.lamprecht at proxmox.com>
---
 src/PVE/LXC.pm | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

diff --git a/src/PVE/LXC.pm b/src/PVE/LXC.pm
index e3433fb..241c5b2 100644
--- a/src/PVE/LXC.pm
+++ b/src/PVE/LXC.pm
@@ -352,17 +352,14 @@ sub update_lxc_config {
     my $custom_idmap = grep { $_->[0] eq 'lxc.id_map' } @{$conf->{lxc}};
 
     my $ostype = $conf->{ostype} || die "missing 'ostype' - internal error";
-    if ($ostype =~ /^(?:debian | ubuntu | centos | fedora | opensuse | archlinux | alpine | gentoo | unmanaged)$/x) {
-	my $inc ="/usr/share/lxc/config/$ostype.common.conf";
-	$inc ="/usr/share/lxc/config/common.conf" if !-f $inc;
-	$raw .= "lxc.include = $inc\n";
-	if ($unprivileged || $custom_idmap) {
-	    $inc = "/usr/share/lxc/config/$ostype.userns.conf";
-	    $inc = "/usr/share/lxc/config/userns.conf" if !-f $inc;
-	    $raw .= "lxc.include = $inc\n"
-	}
-    } else {
-	die "implement me (ostype $ostype)";
+
+    my $inc ="/usr/share/lxc/config/$ostype.common.conf";
+    $inc ="/usr/share/lxc/config/common.conf" if !-f $inc;
+    $raw .= "lxc.include = $inc\n";
+    if ($unprivileged || $custom_idmap) {
+	$inc = "/usr/share/lxc/config/$ostype.userns.conf";
+	$inc = "/usr/share/lxc/config/userns.conf" if !-f $inc;
+	$raw .= "lxc.include = $inc\n"
     }
 
     # WARNING: DO NOT REMOVE this without making sure that loop device nodes
-- 
2.11.0




More information about the pve-devel mailing list