try to get the os name form the pod assigned node (#2282)
* get the os name from the node when needed * code quality * remove err sentinel --------- Co-authored-by: Fernand Galiana <fernand.galiana@gmail.com>mine
parent
5540b5a825
commit
7af4b2d890
|
|
@ -151,7 +151,7 @@ func (n *Node) sshCmd(evt *tcell.EventKey) *tcell.EventKey {
|
|||
defer n.Start()
|
||||
_, node := client.Namespaced(path)
|
||||
if err := ssh(n.App(), node); err != nil {
|
||||
log.Error().Err(err).Msgf("SSH Failed")
|
||||
log.Error().Err(err).Msgf("Node Shell Failed")
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
|
|||
|
|
@ -522,26 +522,26 @@ func getPodOS(f dao.Factory, fqn string) (string, error) {
|
|||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
if os, ok := osFromSelector(po.Spec.NodeSelector); ok {
|
||||
return os, nil
|
||||
if podOS, ok := osFromSelector(po.Spec.NodeSelector); ok {
|
||||
return podOS, nil
|
||||
}
|
||||
|
||||
no, err := dao.FetchNode(context.Background(), f, po.Spec.Hostname)
|
||||
node, err := dao.FetchNode(context.Background(), f, po.Spec.NodeName)
|
||||
if err == nil {
|
||||
if os, ok := osFromSelector(no.Labels); ok {
|
||||
return os, nil
|
||||
if nodeOS, ok := osFromSelector(node.Labels); ok {
|
||||
return nodeOS, nil
|
||||
}
|
||||
}
|
||||
|
||||
return "", fmt.Errorf("no os information available")
|
||||
return "", errors.New("no os information available")
|
||||
}
|
||||
|
||||
func osFromSelector(s map[string]string) (string, bool) {
|
||||
if os, ok := s[osBetaSelector]; ok {
|
||||
return os, ok
|
||||
}
|
||||
os, ok := s[osSelector]
|
||||
|
||||
os, ok := s[osSelector]
|
||||
return os, ok
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue