fix bugs
parent
fa74d4a782
commit
ef311c7fac
|
|
@ -106,7 +106,7 @@ func (c *Container) attachCmd(evt *tcell.EventKey) *tcell.EventKey {
|
|||
|
||||
c.Stop()
|
||||
defer c.Start()
|
||||
attachIn(c.App(), c.GetTable().Path, sel)
|
||||
attachIn(c.App(), c.GetTable().Path)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,5 +13,5 @@ func TestContainerNew(t *testing.T) {
|
|||
|
||||
assert.Nil(t, c.Init(makeCtx()))
|
||||
assert.Equal(t, "Containers", c.Name())
|
||||
assert.Equal(t, 13, len(c.Hints()))
|
||||
assert.Equal(t, 14, len(c.Hints()))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,8 +21,10 @@ func TestHelp(t *testing.T) {
|
|||
v := view.NewHelp()
|
||||
|
||||
assert.Nil(t, v.Init(ctx))
|
||||
assert.Equal(t, 19, v.GetRowCount())
|
||||
assert.Equal(t, 20, v.GetRowCount())
|
||||
assert.Equal(t, 8, v.GetColumnCount())
|
||||
assert.Equal(t, "<ctrl-k>", strings.TrimSpace(v.GetCell(1, 0).Text))
|
||||
assert.Equal(t, "Kill", strings.TrimSpace(v.GetCell(1, 1).Text))
|
||||
assert.Equal(t, "<a>", strings.TrimSpace(v.GetCell(1, 0).Text))
|
||||
assert.Equal(t, "Attach", strings.TrimSpace(v.GetCell(1, 1).Text))
|
||||
// assert.Equal(t, "<ctrl-k>", strings.TrimSpace(v.GetCell(1, 0).Text))
|
||||
// assert.Equal(t, "Kill", strings.TrimSpace(v.GetCell(1, 1).Text))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -159,13 +159,13 @@ func (p *Pod) attachCmd(evt *tcell.EventKey) *tcell.EventKey {
|
|||
return evt
|
||||
}
|
||||
if len(cc) == 1 {
|
||||
p.attachIn(sel, "")
|
||||
p.attachIn(sel)
|
||||
return nil
|
||||
}
|
||||
picker := NewPicker()
|
||||
picker.populate(cc)
|
||||
picker.SetSelectedFunc(func(i int, t, d string, r rune) {
|
||||
p.attachIn(sel, t)
|
||||
p.attachIn(sel)
|
||||
})
|
||||
if err := p.App().inject(picker); err != nil {
|
||||
p.App().Flash().Err(err)
|
||||
|
|
@ -180,9 +180,9 @@ func (p *Pod) shellIn(path, co string) {
|
|||
p.Start()
|
||||
}
|
||||
|
||||
func (p *Pod) attachIn(path, co string) {
|
||||
func (p *Pod) attachIn(path string) {
|
||||
p.Stop()
|
||||
attachIn(p.App(), path, co)
|
||||
attachIn(p.App(), path)
|
||||
p.Start()
|
||||
}
|
||||
|
||||
|
|
@ -221,7 +221,7 @@ func shellIn(a *App, path, co string) {
|
|||
}
|
||||
}
|
||||
|
||||
func attachIn(a *App, path, co string) {
|
||||
func attachIn(a *App, path string) {
|
||||
args := computeAttachArgs(path, a.Config.K9s.CurrentContext, a.Conn().Config().Flags().KubeConfig)
|
||||
log.Debug().Msgf("Attach args %v", args)
|
||||
if !runK(true, a, args...) {
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ func TestPodNew(t *testing.T) {
|
|||
|
||||
assert.Nil(t, po.Init(makeCtx()))
|
||||
assert.Equal(t, "Pods", po.Name())
|
||||
assert.Equal(t, 18, len(po.Hints()))
|
||||
assert.Equal(t, 19, len(po.Hints()))
|
||||
}
|
||||
|
||||
// Helpers...
|
||||
|
|
|
|||
|
|
@ -269,8 +269,7 @@ func (x *Xray) attachCmd(evt *tcell.EventKey) *tcell.EventKey {
|
|||
}
|
||||
|
||||
if ref.Parent != nil {
|
||||
_, co := client.Namespaced(ref.Path)
|
||||
x.attachIn(ref.Parent.Path, co)
|
||||
x.attachIn(ref.Parent.Path)
|
||||
} else {
|
||||
log.Error().Msgf("No parent found on container node %q", ref.Path)
|
||||
}
|
||||
|
|
@ -278,9 +277,9 @@ func (x *Xray) attachCmd(evt *tcell.EventKey) *tcell.EventKey {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (x *Xray) attachIn(path, co string) {
|
||||
func (x *Xray) attachIn(path string) {
|
||||
x.Stop()
|
||||
attachIn(x.app, path, co)
|
||||
attachIn(x.app, path)
|
||||
x.Start()
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue