Skip to content

Commit

Permalink
fix: Handle location in PostNewVersion method
Browse files Browse the repository at this point in the history
  • Loading branch information
NoUseFreak committed Dec 14, 2022
1 parent 60eb516 commit dc74d58
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
7 changes: 4 additions & 3 deletions internal/agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,15 @@ func Run(endpoint, namespace, location string) {
func getNotifyFunc(lc client.LedgerClient, location string) kubernetes.NotifyFunc {
return func(events []kubernetes.Event) error {
for _, e := range events {
if e.Location == "" {
e.Location = location
}
logrus.WithFields(logrus.Fields{
"application": e.Application,
"location": e.Location,
"environment": e.Environment,
"version": e.Version,
}).Info("Notifying ledger")
if e.Location == "" {
e.Location = location
}
if err := lc.PostNewVersion(e.Application, e.Location, e.Environment, e.Version); err != nil {
logrus.Error(err)
}
Expand Down
5 changes: 3 additions & 2 deletions internal/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@ func (c *LedgerClient) PostNewVersion(app, location, env, version string) error
createVersion(input: {
application: "%s",
environment: "%s",
version: "%s"
version: "%s",
location: "%s",
}) {
id
}
}
`, app, env, version),
`, app, env, version, location),
}
jsonValue, _ := json.Marshal(jsonData)
r := regexp.MustCompile(`(\\[tn]|\s+)`)
Expand Down

0 comments on commit dc74d58

Please sign in to comment.