]> git.proxmox.com Git - pve-container.git/commitdiff
include custom lxc options when displaying config
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Tue, 5 Jul 2016 08:30:10 +0000 (10:30 +0200)
committerWolfgang Bumiller <w.bumiller@proxmox.com>
Tue, 5 Jul 2016 08:39:42 +0000 (10:39 +0200)
this makes the "pct config" output more complete, the object
returned by the API path contains the lxc options as parsed
by our config parser, e.g.:

   "lxc" : [
      [
         "lxc.cap.keep",
         "sys_time"
      ],
      [
         "lxc.cap.drop",
         "abc"
      ],
      [
         "lxc.cap.drop",
         ""
      ]
   ],

src/PVE/API2/LXC/Config.pm
src/PVE/CLI/pct.pm

index 0d0732e00aa195665620969e2f3315e636bd7a96..8597192ad583c6c00fd0029da73080ccc1bc89db 100644 (file)
@@ -51,7 +51,6 @@ __PACKAGE__->register_method({
        my $conf = PVE::LXC::Config->load_config($param->{vmid});
 
        delete $conf->{snapshots};
-       delete $conf->{lxc};
 
        return $conf;
     }});
index b660585f4d1116fb19daf7172893a85fd35c1b7f..3e99313a73276d6643c6c45b652a2cc8ab07fd9d 100755 (executable)
@@ -625,12 +625,19 @@ our $cmddef = {
                    my $config = shift;
                    foreach my $k (sort (keys %$config)) {
                        next if $k eq 'digest';
+                       next if $k eq 'lxc';
                        my $v = $config->{$k};
                        if ($k eq 'description') {
                            $v = PVE::Tools::encode_text($v);
                        }
                        print "$k: $v\n";
                    }
+                   if (defined($config->{'lxc'})) {
+                       my $lxc_list = $config->{'lxc'};
+                       foreach my $lxc_opt (@$lxc_list) {
+                           print "$lxc_opt->[0]: $lxc_opt->[1]\n"
+                       }
+                   }
                }],
     set => [ 'PVE::API2::LXC::Config', 'update_vm', ['vmid'], { node => $nodename }],