+ $param->{fingerprint} = $last_fp if !defined($param->{fingerprint});
+ my $plugin = PVE::APIClient::Config->lookup('remote');
+ my $opts = $plugin->check_config($remote, $param, 1, 1);
+ $config->{ids}->{$remote} = $opts;
+
+ PVE::APIClient::Config->save($config);
+
+ return undef;
+ }});
+
+__PACKAGE__->register_method ({
+ name => 'update',
+ path => 'update',
+ method => 'PUT',
+ description => "Update a remote configuration.",
+ parameters => PVE::APIClient::Config->updateSchema(1),
+ returns => { type => 'null'},
+ code => sub {
+ my ($param) = @_;
+
+ # fixme: lock config file
+
+ my $name = extract_param($param, 'name');
+ my $digest = extract_param($param, 'digest');
+ my $delete = extract_param($param, 'delete');
+
+ my $config = PVE::APIClient::Config->load();
+ my $remote = PVE::APIClient::Config->lookup_remote($config, $name);
+
+ my $plugin = PVE::APIClient::Config->lookup('remote');
+ my $opts = $plugin->check_config($name, $param, 0, 1);
+
+ foreach my $k (%$opts) {
+ $remote->{$k} = $opts->{$k};
+ }
+
+ if ($delete) {
+ my $options = $plugin->private()->{options}->{'remote'};
+ foreach my $k (PVE::Tools::split_list($delete)) {
+ my $d = $options->{$k} ||
+ die "no such option '$k'\n";
+ die "unable to delete required option '$k'\n"
+ if !$d->{optional};
+ die "unable to delete fixed option '$k'\n"
+ if $d->{fixed};
+ delete $remote->{$k};
+ }
+ }
+
+ PVE::APIClient::Config->save($config);