Skip to content

Commit

Permalink
fix: unsupported relationship HopId
Browse files Browse the repository at this point in the history
Fixes moul#329
  • Loading branch information
vdombrovski authored and libvoid committed Jul 13, 2023
1 parent 12fb703 commit 3186f46
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions pkg/bastion/shell.go
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,7 @@ GLOBAL OPTIONS:
var hop string
if host.HopID != 0 {
var hopHost dbmodels.Host
if err := db.Model(host).Association("HopID").Find(&hopHost); err != nil {
if err := db.Model(host).Association("Hop").Find(&hopHost); err != nil {
return err
}
hop = hopHost.Name
Expand Down Expand Up @@ -1037,7 +1037,7 @@ GLOBAL OPTIONS:
if c.Bool("unset-hop") {
var hopHost dbmodels.Host

if err := db.Model(&host).Association("HopID").Find(&hopHost); err != nil {
if err := db.Model(&host).Association("Hop").Find(&hopHost); err != nil {
return err
}
if err := model.Association("Hop").Clear(); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/bastion/ssh.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func ChannelHandler(srv *ssh.Server, conn *gossh.ServerConn, newChan gossh.NewCh
}}, sessionConfigs...)
if currentHost.HopID != 0 {
var newHost dbmodels.Host
if err := actx.db.Model(currentHost).Association("HopID").Find(&newHost); err != nil {
if err := actx.db.Model(currentHost).Association("Hop").Find(&newHost); err != nil {
log.Printf("Error: %v", err)
return
}
Expand Down

0 comments on commit 3186f46

Please sign in to comment.