]>
git.proxmox.com Git - pve-client.git/blob - PVE/APIClient/Commands/config.pm
1 package PVE
::APIClient
::Commands
::config
;
7 use PVE
::APIClient
::JSONSchema
qw(get_standard_option);
8 use PVE
::APIClient
::Tools
qw(extract_param);
9 use PVE
::APIClient
::Config
;
11 use PVE
::APIClient
::CLIHandler
;
13 use base
qw(PVE::APIClient::CLIHandler);
15 __PACKAGE__-
>register_method ({
19 description
=> "Dump default configuration.",
21 additionalProperties
=> 0,
23 returns
=> { type
=> 'null' },
26 my $config = PVE
::APIClient
::Config-
>load();
28 my $defaults = PVE
::APIClient
::Config-
>get_defaults($config);
31 print Dumper
($config);
36 __PACKAGE__-
>register_method ({
40 description
=> "Update a remote configuration.",
41 parameters
=> PVE
::APIClient
::DefaultsConfig-
>updateSchema(1),
42 returns
=> { type
=> 'null'},
46 # fixme: lock config file
48 my $digest = extract_param
($param, 'digest');
49 my $delete = extract_param
($param, 'delete');
51 my $config = PVE
::APIClient
::Config-
>load();
52 my $defaults = PVE
::APIClient
::Config-
>get_defaults($config);
54 my $plugin = PVE
::APIClient
::Config-
>lookup('defaults');
55 my $opts = $plugin->check_config('defaults', $param, 0, 1);
57 foreach my $k (%$opts) {
58 $defaults->{$k} = $opts->{$k};
62 my $options = $plugin->private()->{options
}->{'defaults'};
63 foreach my $k (PVE
::APIClient
::Tools
::split_list
($delete)) {
64 my $d = $options->{$k} ||
65 die "no such option '$k'\n";
66 die "unable to delete required option '$k'\n"
68 die "unable to delete fixed option '$k'\n"
70 delete $defaults->{$k};
74 PVE
::APIClient
::Config-
>save($config);
81 set
=> [ __PACKAGE__
, 'set',],
82 list
=> [__PACKAGE__
, 'list'],