]>
Commit | Line | Data |
---|---|---|
895b703e TL |
1 | #!/usr/bin/perl |
2 | ||
3 | use strict; | |
4 | use warnings; | |
5 | ||
6 | use lib '../'; | |
7 | ||
4195bf0a TL |
8 | use JSON; |
9 | ||
10 | use PVE::Tools qw(dir_glob_foreach file_get_contents); | |
895b703e TL |
11 | |
12 | my $dnsapi_path = '../acme.sh/dnsapi'; | |
13 | ||
14 | die "cannot find dnsapi path '$dnsapi_path'!\n" if ! -d $dnsapi_path; | |
15 | ||
16 | my $acmesh_plugins = []; | |
17 | dir_glob_foreach($dnsapi_path, qr/dns_(\S+)\.sh/, sub { | |
18 | my ($file, $provider) = @_; | |
19 | push @$acmesh_plugins, $provider; | |
20 | }); | |
21 | ||
4195bf0a TL |
22 | my $DNS_API_CHALLENGE_SCHEMA_FN = '../dns-challenge-schema.json'; |
23 | my $defined_plugins = from_json(PVE::Tools::file_get_contents($DNS_API_CHALLENGE_SCHEMA_FN)); | |
895b703e | 24 | |
4195bf0a | 25 | my $ok = 1; |
895b703e TL |
26 | # first check for missing ones, delete from hash so we can easily see if a plug got removed/renamed |
27 | my $printed_missing = 0; | |
28 | for my $provider (sort @$acmesh_plugins) { | |
29 | my $schema = delete $defined_plugins->{$provider}; | |
30 | if (!defined($schema)) { | |
31 | print STDERR "missing (also adapt makefile!):\n" if !$printed_missing; | |
32 | print STDERR " '$provider' => {},\n"; | |
33 | $printed_missing = 1; | |
34 | $ok = 0; | |
35 | } | |
36 | } | |
37 | ||
38 | my $printed_extra = 0; | |
39 | for my $provider (sort keys %$defined_plugins) { | |
40 | print STDERR "extra:\n" if !$printed_extra; | |
41 | print STDERR " $provider\n"; | |
42 | $printed_extra = 1; | |
43 | $ok = 0; | |
44 | } | |
45 | ||
46 | die "schema not in sync with available plugins!\n" if !$ok; | |
47 | ||
48 | print STDERR "OK: DNS challenge schema in sync with available plugins.\n"; | |
49 | exit(0); |