Signed-off-by: Fabian Ebner <[email protected]>
---
 PVE/API2/APT.pm | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 46 insertions(+)

diff --git a/PVE/API2/APT.pm b/PVE/API2/APT.pm
index e92770ca..aa3d9b94 100644
--- a/PVE/API2/APT.pm
+++ b/PVE/API2/APT.pm
@@ -69,6 +69,7 @@ __PACKAGE__->register_method({
            { id => 'changelog' },
            { id => 'update' },
            { id => 'repositories' },
+           { id => 'repositoriescheck' },
            { id => 'versions' },
        ];
 
@@ -547,6 +548,51 @@ __PACKAGE__->register_method({
        return PVE::APT::list_repositories();
     }});
 
+__PACKAGE__->register_method({
+    name => 'repositoriescheck',
+    path => 'repositoriescheck',
+    method => 'GET',
+    proxyto => 'node',
+    description => "Check APT repositories.",
+    permissions => {
+       check => ['perm', '/nodes/{node}', [ 'Sys.Audit' ]],
+    },
+    parameters => {
+       additionalProperties => 0,
+       properties => {
+           node => get_standard_option('pve-node'),
+       },
+    },
+    returns => {
+       type => "array",
+       description => "List of warnings.",
+       items => {
+           type => "object",
+           properties => {
+               path => {
+                   type => 'string',
+                   description => "Path to the file that defines the 
repository.",
+                   optional => 1,
+               },
+               number => {
+                   type => 'integer',
+                   description => "Line or stanza number.",
+                   optional => 1,
+               },
+               message => {
+                   type => 'string',
+                   description => "The warning message.",
+               },
+           },
+       },
+    },
+    code => sub {
+       my ($param) = @_;
+
+       my $repos = PVE::APT::list_repositories();
+       return PVE::APT::check_repositories($repos, 'pve');
+    }});
+
 __PACKAGE__->register_method({
     name => 'versions', 
     path => 'versions', 
-- 
2.20.1



_______________________________________________
pve-devel mailing list
[email protected]
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to