8000 fix(cdsctl): Call user and config user only one time (#3443) · ovh/cds@92a1ae2 · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Commit 92a1ae2

Browse files
richardltyesnault
authored andcommitted
fix(cdsctl): Call user and config user only one time (#3443)
1 parent a33db19 commit 92a1ae2

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

cli/cdsctl/monitoring.go

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,19 @@ func monitoringRun(v cli.Values) (interface{}, error) {
6969
}
7070
}()
7171

72+
urlUI, err := client.ConfigUser()
73+
if err != nil {
74+
return nil, err
75+
}
76+
if b, ok := urlUI[sdk.ConfigURLUIKey]; ok {
77+
ui.baseURL = b
78+
}
79+
80+
ui.me, err = client.UserGet(cfg.User)
81+
if err != nil {
82+
return nil, fmt.Errorf("Can't get current user: %v", err)
83+
}
84+
7285
termui.Loop()
7386

7487
return nil, nil
@@ -111,18 +124,7 @@ type Termui struct {
111124
func (ui *Termui) loadData() { ui.loadChan <- ui.execLoadData }
112125

113126
func (ui *Termui) execLoadData() error {
114-
urlUI, err := client.ConfigUser()
115-
if err != nil {
116-
return err
117-
}
118-
if b, ok := urlUI[sdk.ConfigURLUIKey]; ok {
119-
ui.baseURL = b
120-
}
121-
122-
ui.me, err = client.UserGet(cfg.User)
123-
if err != nil {
124-
return fmt.Errorf("Can't get current user: %v", err)
125-
}
127+
var err error
126128

127129
start := time.Now()
128130
ui.status, err = client.MonStatus()

0 commit comments

Comments
 (0)
0