mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-19 10:46:58 +08:00
climc: add commands server-make-sshable, server-make-sshable-cmd
This commit is contained in:
@@ -85,6 +85,7 @@ func init() {
|
||||
cmd.Perform("save-template", new(options.ServerSaveImageOptions))
|
||||
cmd.Perform("remote-update", new(options.ServerRemoteUpdateOptions))
|
||||
cmd.Perform("create-eip", &options.ServerCreateEipOptions{})
|
||||
cmd.Perform("make-sshable", &options.ServerMakeSshableOptions{})
|
||||
|
||||
cmd.Get("vnc", new(options.ServerIdOptions))
|
||||
cmd.Get("desc", new(options.ServerIdOptions))
|
||||
@@ -92,6 +93,7 @@ func init() {
|
||||
cmd.Get("iso", new(options.ServerIdOptions))
|
||||
cmd.Get("create-params", new(options.ServerIdOptions))
|
||||
cmd.Get("sshable", new(options.ServerIdOptions))
|
||||
cmd.Get("make-sshable-cmd", new(options.ServerIdOptions))
|
||||
cmd.Get("change-owner-candidate-domains", new(options.ServerChangeOwnerCandidateDomainsOptions))
|
||||
|
||||
type ServerTaskShowOptions struct {
|
||||
|
||||
@@ -1089,3 +1089,21 @@ type ServerCreateEipOptions struct {
|
||||
func (opts *ServerCreateEipOptions) Params() (jsonutils.JSONObject, error) {
|
||||
return jsonutils.Marshal(opts), nil
|
||||
}
|
||||
|
||||
type ServerMakeSshableOptions struct {
|
||||
BaseIdOptions
|
||||
|
||||
User string `help:"ssh username for ssh connection" default:"root"`
|
||||
PrivateKey string `help:"ssh privatekey for ssh connection"`
|
||||
Password string `help:"ssh password for ssh connection"`
|
||||
}
|
||||
|
||||
func (opts *ServerMakeSshableOptions) Params() (jsonutils.JSONObject, error) {
|
||||
if opts.User == "" {
|
||||
return nil, fmt.Errorf("ssh username must be set")
|
||||
}
|
||||
if opts.PrivateKey == "" && opts.Password == "" {
|
||||
return nil, fmt.Errorf("either --private-key or --password must be set")
|
||||
}
|
||||
return jsonutils.Marshal(opts), nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user