Signed-off-by: Thomas Lamprecht <t.lampre...@proxmox.com> --- I tend to not check for the version, but simply do the POST request on "/cluster/config/join" and handle the "not implemented" error instead, seems to be straight forward and does not needs an timed version bump.
data/PVE/API2/ClusterConfig.pm | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/data/PVE/API2/ClusterConfig.pm b/data/PVE/API2/ClusterConfig.pm index 9a4d9f5..97706d9 100644 --- a/data/PVE/API2/ClusterConfig.pm +++ b/data/PVE/API2/ClusterConfig.pm @@ -96,6 +96,23 @@ my $config_change_lock = sub { }); }; +my $peer_can_use_api = sub { + my ($conn) = @_; + + print "Probe peer cluster package version...\n"; + my $res = $conn->get("/nodes/localhost/apt/versions"); + + my $api_ok = undef; + foreach my $pkg (@$res) { + next if $pkg->{Package} ne 'pve-cluster'; + if ($pkg->{OldVersion} =~ m/^(\d\.\d)-(\d+)/) { + my ($version, $release) = ($1, $2); + $api_ok = 1 if $version >= 5.1 && $release >= 16; + } + } + + return $api_ok; +}; __PACKAGE__->register_method ({ name => 'join', @@ -197,6 +214,10 @@ __PACKAGE__->register_method ({ print "Login succeeded.\n"; + if (!$peer_can_use_api->($conn)) { + die "Cannot use API to join, peer is not up to date!\n"; + } + my $args = { node => $nodename, }; -- 2.11.0 _______________________________________________ pve-devel mailing list pve-devel@pve.proxmox.com https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel