]>
git.proxmox.com Git - pve-client.git/blob - PVE/APIClient/Commands/config.pm
1 package PVE
::APIClient
::Commands
::config
;
7 use PVE
::APIClient
::Helpers
;
8 use PVE
::APIClient
::JSONSchema
qw(get_standard_option);
9 use PVE
::APIClient
::Tools
qw(extract_param);
10 use PVE
::APIClient
::Config
;
12 use PVE
::APIClient
::CLIHandler
;
14 use base
qw(PVE::APIClient::CLIHandler);
16 __PACKAGE__-
>register_method ({
20 description
=> "Dump default configuration.",
22 additionalProperties
=> 0,
24 returns
=> { type
=> 'null' },
27 my $config = PVE
::APIClient
::Config-
>load();
29 my $defaults = PVE
::APIClient
::Config-
>get_defaults($config);
32 print Dumper
($config);
37 __PACKAGE__-
>register_method ({
41 description
=> "Update a remote configuration.",
42 parameters
=> PVE
::APIClient
::DefaultsConfig-
>updateSchema(1),
43 returns
=> { type
=> 'null'},
47 my $digest = extract_param
($param, 'digest');
48 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);
77 PVE
::APIClient
::Config-
>lock_config(undef, $code);
84 set
=> [ __PACKAGE__
, 'set',],
85 list
=> [__PACKAGE__
, 'list'],