set machine on proc update

This commit is contained in:
Brad Rydzewski 2017-07-19 23:07:29 -04:00
parent 250b048b22
commit 9720337655

View file

@ -144,6 +144,14 @@ func (s *RPC) Update(c context.Context, id string, state rpc.State) error {
return err return err
} }
metadata, ok := metadata.FromContext(c)
if ok {
hostname, ok := metadata["hostname"]
if ok && len(hostname) != 0 {
proc.Machine = hostname[0]
}
}
repo, err := s.store.GetRepo(build.RepoID) repo, err := s.store.GetRepo(build.RepoID)
if err != nil { if err != nil {
log.Printf("error: cannot find repo with id %d: %s", build.RepoID, err) log.Printf("error: cannot find repo with id %d: %s", build.RepoID, err)
@ -209,14 +217,6 @@ func (s *RPC) Upload(c context.Context, id string, file *rpc.File) error {
return err return err
} }
metadata, ok := metadata.FromContext(c)
if ok {
hostname, ok := metadata["hostname"]
if ok && len(hostname) != 0 {
proc.Machine = hostname[0]
}
}
if file.Mime == "application/json+logs" { if file.Mime == "application/json+logs" {
return s.store.LogSave( return s.store.LogSave(
proc, proc,