[pbs-devel] [RFC v5 pve-manager 23/23] api: apt: add upgrade repos call

Fabian Ebner f.ebner at proxmox.com
Fri May 28 16:30:02 CEST 2021


Signed-off-by: Fabian Ebner <f.ebner at proxmox.com>
---

New in v5.

 PVE/API2/APT.pm | 36 ++++++++++++++++++++++++++++++++++++
 1 file changed, 36 insertions(+)

diff --git a/PVE/API2/APT.pm b/PVE/API2/APT.pm
index 10f18944..5164a0ab 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' },
 	];
 
@@ -707,6 +708,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) = @_;
+
+	my $digest = $param->{digest} // '';
+
+	#	die "PVE 7.0 is not released yet or pve-manager is not the latest version\n";
+
+	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