mirror of
https://github.com/lxc/incus
synced 2026-08-02 05:26:46 +00:00
shared/cliconfig: Don't needlessly use format string functions
Signed-off-by: Nathan Chase <ntc477@utexas.edu>
This commit is contained in:
parent
0bef06dc6a
commit
ed5778e5ef
@ -1,8 +1,8 @@
|
||||
package cliconfig
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"errors"
|
||||
)
|
||||
|
||||
// ErrNotLinux is returned when attempting to access the "local" remote on non-Linux systems.
|
||||
var ErrNotLinux = fmt.Errorf("Can't connect to a local server on a non-Linux system")
|
||||
var ErrNotLinux = errors.New("Can't connect to a local server on a non-Linux system")
|
||||
|
||||
@ -3,11 +3,11 @@
|
||||
package cliconfig
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"errors"
|
||||
|
||||
incus "github.com/lxc/incus/v6/client"
|
||||
)
|
||||
|
||||
func (c *Config) handleKeepAlive(remote Remote, name string, args *incus.ConnectionArgs) (incus.InstanceServer, error) {
|
||||
return nil, fmt.Errorf("Keepalive isn't supported on Windows")
|
||||
return nil, errors.New("Keepalive isn't supported on Windows")
|
||||
}
|
||||
|
||||
@ -70,7 +70,7 @@ func (c *Config) GetInstanceServer(name string) (incus.InstanceServer, error) {
|
||||
|
||||
// Quick checks.
|
||||
if remote.Public || remote.Protocol != "incus" {
|
||||
return nil, fmt.Errorf("The remote isn't a private server")
|
||||
return nil, errors.New("The remote isn't a private server")
|
||||
}
|
||||
|
||||
// Get connection arguments
|
||||
@ -115,7 +115,7 @@ func (c *Config) GetInstanceServer(name string) (incus.InstanceServer, error) {
|
||||
|
||||
// HTTPs
|
||||
if !slices.Contains([]string{api.AuthenticationMethodOIDC}, remote.AuthType) && (args.TLSClientCert == "" || args.TLSClientKey == "") {
|
||||
return nil, fmt.Errorf("Missing TLS client certificate and key")
|
||||
return nil, errors.New("Missing TLS client certificate and key")
|
||||
}
|
||||
|
||||
var d incus.InstanceServer
|
||||
@ -347,7 +347,7 @@ func (c *Config) getConnectionArgs(name string) (*incus.ConnectionArgs, error) {
|
||||
isSSH := pemKey.Type == "OPENSSH PRIVATE KEY"
|
||||
if isEncrypted || isSSH {
|
||||
if c.PromptPassword == nil {
|
||||
return nil, fmt.Errorf("Private key is password protected and no helper was configured")
|
||||
return nil, errors.New("Private key is password protected and no helper was configured")
|
||||
}
|
||||
|
||||
password, err := c.PromptPassword(pathClientKey)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user