Skip to content

Commit

Permalink
Fix 'unsupported relationship HopId'
Browse files Browse the repository at this point in the history
Fixes moul#329

(cherry picked from commit 1f3e507)
  • Loading branch information
vdombrovski authored and easybe committed Oct 7, 2023
1 parent d3e885c commit 8bd4f7c
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 @@ -1028,7 +1028,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 @@ -144,7 +144,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 8bd4f7c

Please sign in to comment.