]> git.proxmox.com Git - pve-common.git/blobdiff - src/PVE/INotify.pm
Inotify: delete vlan-id for "iface.X" vlan iface.
[pve-common.git] / src / PVE / INotify.pm
index 5ff95a88d80494e33faf8a1b62afec9c71825a6b..2bb87bb2dd71e79057dcaa2da391316686e7bc23 100644 (file)
@@ -1554,6 +1554,8 @@ sub __write_etc_network_interfaces {
                $p = $1;
                $vlanid = $2;
                delete $d->{'vlan-raw-device'} if $d->{'vlan-raw-device'};
+               delete $d->{'vlan-id'} if $d->{'vlan-id'};
+
            } else {
                die "missing vlan-raw-device option" if !$d->{'vlan-raw-device'};
                $p = $d->{'vlan-raw-device'};
@@ -1619,7 +1621,7 @@ sub __write_etc_network_interfaces {
                die "bridge '$iface' - unable to find bridge port '$p'\n" if !$n;
                die "iface $p - ip address can't be set on interface if bridged in $iface\n"
                    if ($n->{method} && $n->{method} eq 'static' && $n->{address} ne '0.0.0.0') ||
-                      ($n->{method6} && $n->{method6} eq 'static' && $n->{address} ne '::');
+                      ($n->{method6} && $n->{method6} eq 'static' && $n->{address6} ne '::');
                &$check_mtu($ifaces_copy, $p, $iface);
                $bridgeports->{$p} = $iface;
            }
@@ -1674,12 +1676,10 @@ NETWORKDOC
 
        my ($rootiface, @rest) = split(/[.:]/, $iface);
        my $childlevel = scalar(@rest);
-       my $n = $ifaces->{$rootiface};
-
-       my $pri = $if_type_hash->{$n->{type}} + $childlevel
-           if $n->{type} && $n->{type} ne 'unknown';
+       my $type = $ifaces->{$rootiface}->{type};
+       return if !$type || $type eq 'unknown';
 
-       return $pri;
+       return $if_type_hash->{$type} + $childlevel
     };
 
     foreach my $iface (sort {
@@ -1780,8 +1780,11 @@ my $format_apt_auth_data = sub {
 
     my $raw = '';
 
-    foreach my $machine (sort keys %$data) {
+    # sort longer entries first, so machine definitions with higher granularity are preferred
+    for my $machine (sort { length($b) <=> length($a) || $a cmp $b} keys %$data) {
        my $d = $data->{$machine};
+       next if !defined($d); # allow "deleting" set entries
+
        $raw .= "machine $machine\n";
        $raw .= " login $d->{login}\n" if $d->{login};
        $raw .= " password $d->{password}\n" if $d->{password};
@@ -1794,7 +1797,7 @@ my $format_apt_auth_data = sub {
 sub write_apt_auth {
     my ($filename, $fh, $data) = @_;
 
-    my $raw = &$format_apt_auth_data($data);
+    my $raw = $format_apt_auth_data->($data);
 
     die "write failed: $!" unless print $fh "$raw\n";
 
@@ -1810,11 +1813,16 @@ sub update_apt_auth {
        $orig->{$machine} = $data->{$machine};
     }
 
-    return &$format_apt_auth_data($orig);
+    return $format_apt_auth_data->($orig);
 }
 
-register_file('apt-auth', "/etc/apt/auth.conf",
-             \&read_apt_auth, \&write_apt_auth,
-             \&update_apt_auth, perm => 0640);
+register_file(
+    'apt-auth',
+    "/etc/apt/auth.conf",
+    \&read_apt_auth,
+    \&write_apt_auth,
+    \&update_apt_auth,
+    perm => 0640,
+);
 
 1;