Skip to content

Commit

Permalink
merge init and connect
Browse files Browse the repository at this point in the history
  • Loading branch information
Naseredin Aramnejad committed Mar 16, 2022
1 parent 8d52e01 commit b72b398
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions pssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,11 @@ func writeBuff(command string, sshIn io.WriteCloser) (int, error) {
}

//Connect connects to the specified server and opens a session (Filling the Client and Session fields in SshAgent struct).
func (s *Nokia_1830PSS) connect() error {
func (s *Nokia_1830PSS) Connect() error {
if err := validateNode(s); err != nil {
return err
}

var err error
config := &ssh.ClientConfig{
User: "cli",
Expand Down Expand Up @@ -237,15 +241,3 @@ func validateNode(ne *Nokia_1830PSS) error {

return nil
}

//Init initialises the ssh connection and returns the reusable ssh agent.
func Init(ne *Nokia_1830PSS) error {
if err := validateNode(ne); err != nil {
return err
}

if err := ne.connect(); err != nil {
return err
}
return nil
}

0 comments on commit b72b398

Please sign in to comment.