]>
git.proxmox.com Git - pve-manager.git/blob - PVE/API2/NodeConfig.pm
1 package PVE
::API2
::NodeConfig
;
6 use PVE
::JSONSchema
qw(get_standard_option);
8 use PVE
::Tools
qw(extract_param);
10 use base
qw(PVE::RESTHandler);
12 my $node_config_schema = PVE
::NodeConfig
::get_nodeconfig_schema
();
13 my $node_config_properties = {
15 type
=> 'string', format
=> 'pve-configid-list',
16 description
=> "A list of settings you want to delete.",
21 description
=> 'Prevent changes if current configuration file has different SHA1 digest. This can be used to prevent concurrent modifications.',
25 node
=> get_standard_option
('pve-node'),
28 foreach my $opt (keys %{$node_config_schema}) {
29 $node_config_properties->{$opt} = $node_config_schema->{$opt};
32 __PACKAGE__-
>register_method({
36 description
=> "Get node configuration options.",
38 check
=> ['perm', '/', [ 'Sys.Audit' ]],
42 additionalProperties
=> 0,
44 node
=> get_standard_option
('pve-node'),
54 return PVE
::NodeConfig
::load_config
($param->{node
});
57 __PACKAGE__-
>register_method({
58 name
=> 'set_options',
61 description
=> "Set node configuration options.",
63 check
=> ['perm', '/', [ 'Sys.Modify' ]],
68 additionalProperties
=> 0,
69 properties
=> $node_config_properties,
71 returns
=> { type
=> "null" },
75 my $delete = extract_param
($param, 'delete');
76 my $node = extract_param
($param, 'node');
77 my $digest = extract_param
($param, 'digest');
80 my $conf = PVE
::NodeConfig
::load_config
($node);
82 PVE
::Tools
::assert_if_modified
($digest, $conf->{digest
});
84 foreach my $opt (keys %$param) {
85 $conf->{$opt} = $param->{$opt};
88 foreach my $opt (PVE
::Tools
::split_list
($delete)) {
92 PVE
::NodeConfig
::write_config
($node, $conf);
95 PVE
::NodeConfig
::lock_config
($node, $code);