修复: webconsole参数缺失,导致yunionapi RPC调用失败

This commit is contained in:
屈轩
2018-12-05 20:35:53 +08:00
parent 2239592dcb
commit e66be4ca42
2 changed files with 8 additions and 22 deletions
+2 -2
View File
@@ -58,7 +58,7 @@ func init() {
})
R(&o.WebConsoleBaremetalOptions{}, "webconsole-baremetal", "Connect baremetal host webconsole", func(s *mcclient.ClientSession, args *o.WebConsoleBaremetalOptions) error {
ret, err := modules.WebConsole.DoBaremetalConnect(s, args.ID)
ret, err := modules.WebConsole.DoBaremetalConnect(s, args.ID, nil)
if err != nil {
return err
}
@@ -67,7 +67,7 @@ func init() {
})
R(&o.WebConsoleSshOptions{}, "webconsole-ssh", "Connect ssh webconsole", func(s *mcclient.ClientSession, args *o.WebConsoleSshOptions) error {
ret, err := modules.WebConsole.DoSshConnect(s, args.IP)
ret, err := modules.WebConsole.DoSshConnect(s, args.IP, nil)
if err != nil {
return err
}
+6 -20
View File
@@ -26,11 +26,7 @@ func NewWebConsoleManager() ResourceManager {
Keyword: "webconsole", KeywordPlural: "webconsole"}
}
func (m WebConsoleManager) DoConnect(
s *mcclient.ClientSession,
connType, id, action string,
params jsonutils.JSONObject,
) (jsonutils.JSONObject, error) {
func (m WebConsoleManager) DoConnect(s *mcclient.ClientSession, connType, id, action string, params jsonutils.JSONObject) (jsonutils.JSONObject, error) {
if len(connType) == 0 {
return nil, fmt.Errorf("Empty connection resource type")
}
@@ -44,32 +40,22 @@ func (m WebConsoleManager) DoConnect(
return m._post(s, url, params, "webconsole")
}
func (m WebConsoleManager) DoK8sConnect(
s *mcclient.ClientSession,
id, action string,
params jsonutils.JSONObject,
) (jsonutils.JSONObject, error) {
func (m WebConsoleManager) DoK8sConnect(s *mcclient.ClientSession, id, action string, params jsonutils.JSONObject) (jsonutils.JSONObject, error) {
return m.DoConnect(s, "k8s", id, action, params)
}
func (m WebConsoleManager) DoK8sShellConnect(
s *mcclient.ClientSession,
id string, params jsonutils.JSONObject,
) (jsonutils.JSONObject, error) {
func (m WebConsoleManager) DoK8sShellConnect(s *mcclient.ClientSession, id string, params jsonutils.JSONObject) (jsonutils.JSONObject, error) {
return m.DoK8sConnect(s, id, "shell", params)
}
func (m WebConsoleManager) DoK8sLogConnect(
s *mcclient.ClientSession,
id string, params jsonutils.JSONObject,
) (jsonutils.JSONObject, error) {
func (m WebConsoleManager) DoK8sLogConnect(s *mcclient.ClientSession, id string, params jsonutils.JSONObject) (jsonutils.JSONObject, error) {
return m.DoK8sConnect(s, id, "log", params)
}
func (m WebConsoleManager) DoBaremetalConnect(s *mcclient.ClientSession, id string) (jsonutils.JSONObject, error) {
func (m WebConsoleManager) DoBaremetalConnect(s *mcclient.ClientSession, id string, params jsonutils.JSONObject) (jsonutils.JSONObject, error) {
return m.DoConnect(s, "baremetal", id, "", nil)
}
func (m WebConsoleManager) DoSshConnect(s *mcclient.ClientSession, id string) (jsonutils.JSONObject, error) {
func (m WebConsoleManager) DoSshConnect(s *mcclient.ClientSession, id string, params jsonutils.JSONObject) (jsonutils.JSONObject, error) {
return m.DoConnect(s, "ssh", id, "", nil)
}