[pbs-devel] [PATCH v6 pve-manager 4/5] api: apt: add upgrade repos call
Fabian Ebner
f.ebner at proxmox.com
Fri Jun 11 13:44:17 CEST 2021
Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---
Changes from v5:
* 'digest' argument is now an Option<&str> for the exported Rust function.
PVE/API2/APT.pm | 36 ++++++++++++++++++++++++++++++++++++
1 file changed, 36 insertions(+)
diff --git a/PVE/API2/APT.pm b/PVE/API2/APT.pm
index 2815785e..a9a97c37 100644
--- a/PVE/API2/APT.pm
+++ b/PVE/API2/APT.pm
@@ -70,6 +70,7 @@ __PACKAGE__->register_method({
{ id => 'repositories' },
{ id => 'checkrepositories' },
{ id => 'update' },
+ { id => 'upgraderepositories' },
{ id => 'versions' },
];
@@ -709,6 +710,41 @@ __PACKAGE__->register_method({
};
}});
+__PACKAGE__->register_method({
+ name => 'upgraderepositories',
+ path => 'upgraderepositories',
+ method => 'PUT',
+ proxyto => 'node',
+ protected => 1,
+ description => "Upgrade APT repository suites to the next stable release.",
+ permissions => {
+ check => ['perm', '/nodes/{node}', [ 'Sys.Modify' ]],
+ },
+ parameters => {
+ additionalProperties => 0,
+ properties => {
+ node => get_standard_option('pve-node'),
+ digest => {
+ type => "string",
+ description => "Digest to detect modifications.",
+ maxLength => 80,
+ optional => 1,
+ },
+ },
+ },
+ returns => { type => 'null' },
+ code => sub {
+ my ($param) = @_;
+
+ # NOTE As of perlmod 0.4.3, passing $param->{digest} directly will fail if the value is
+ # undef. Assign it to a variable first to work around the issue.
+ my $digest = $param->{digest};
+
+ PVE::RS::APT::Repositories::upgrade_repositories($digest);
+
+ return;
+ }});
+
__PACKAGE__->register_method({
name => 'versions',
path => 'versions',
--
2.20.1
More information about the pbs-devel
mailing list