set machine on proc update
This commit is contained in:
parent
250b048b22
commit
9720337655
1 changed files with 8 additions and 8 deletions
|
@ -144,6 +144,14 @@ func (s *RPC) Update(c context.Context, id string, state rpc.State) error {
|
|||
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)
|
||||
if err != nil {
|
||||
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
|
||||
}
|
||||
|
||||
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" {
|
||||
return s.store.LogSave(
|
||||
proc,
|
||||
|
|
Loading…
Reference in a new issue