From e66be4ca423ee5504db34bf61459e9318a444fd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=B1=88=E8=BD=A9?= Date: Wed, 5 Dec 2018 20:35:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D:=20webconsole=E5=8F=82?= =?UTF-8?q?=E6=95=B0=E7=BC=BA=E5=A4=B1=EF=BC=8C=E5=AF=BC=E8=87=B4yunionapi?= =?UTF-8?q?=20RPC=E8=B0=83=E7=94=A8=E5=A4=B1=E8=B4=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/climc/shell/webconsole.go | 4 ++-- pkg/mcclient/modules/mod_webconsole.go | 26 ++++++-------------------- 2 files changed, 8 insertions(+), 22 deletions(-) diff --git a/cmd/climc/shell/webconsole.go b/cmd/climc/shell/webconsole.go index e8d4a26d9f..928e9ea8d0 100644 --- a/cmd/climc/shell/webconsole.go +++ b/cmd/climc/shell/webconsole.go @@ -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 } diff --git a/pkg/mcclient/modules/mod_webconsole.go b/pkg/mcclient/modules/mod_webconsole.go index 963240028d..509de4c575 100644 --- a/pkg/mcclient/modules/mod_webconsole.go +++ b/pkg/mcclient/modules/mod_webconsole.go @@ -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) }