Skip to content

Commit

Permalink
client: Check 'console_force' API extenstion
Browse files Browse the repository at this point in the history
Signed-off-by: Piotr Resztak <piotr.resztak@futurfusion.io>
  • Loading branch information
presztak committed Dec 11, 2024
1 parent 8949e0c commit d22effd
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions client/incus_instances.go
Original file line number Diff line number Diff line change
Expand Up @@ -2528,6 +2528,10 @@ func (r *ProtocolIncus) ConsoleInstance(instanceName string, console api.Instanc
return nil, fmt.Errorf("The server is missing the required \"console_vga_type\" API extension")
}

if console.Force && !r.HasExtension("console_force") {
return nil, fmt.Errorf(`The server is missing the required "console_force" API extension`)
}

// Send the request
op, _, err := r.queryOperation("POST", fmt.Sprintf("%s/%s/console", path, url.PathEscape(instanceName)), console, "")
if err != nil {
Expand Down Expand Up @@ -2616,6 +2620,10 @@ func (r *ProtocolIncus) ConsoleInstanceDynamic(instanceName string, console api.
return nil, nil, fmt.Errorf("The server is missing the required \"console_vga_type\" API extension")
}

if console.Force && !r.HasExtension("console_force") {
return nil, nil, fmt.Errorf(`The server is missing the required "console_force" API extension`)
}

// Send the request.
op, _, err := r.queryOperation("POST", fmt.Sprintf("%s/%s/console", path, url.PathEscape(instanceName)), console, "")
if err != nil {
Expand Down

0 comments on commit d22effd

Please sign in to comment.