code: func (p *Pod) UpdateManifest(m *schema.PodManifest, path string) error {
  	if !p.mutable {
  		return ErrImmutable
  	}
  
  	mpath := common.PodManifestPath(path)
  	mstat, err := os.Stat(mpath)
  	if err != nil {
  		return err
  	}
  
  	tmpf, err := ioutil.TempFile(path, "")
  	if err != nil {
  		return err
  	}
  
  	defer func() {
  		tmpf.Close()
  		os.Remove(tmpf.Name())
  	}()
  
  	if err := tmpf.Chmod(mstat.Mode().Perm()); err != nil {
  		return err
  	}
  
  	if err := json.NewEncoder(tmpf).Encode(m); err != nil {
  		return err
  	}
  
  	if err := os.Rename(tmpf.Name(), mpath); err != nil {
  		return err
  	}
  
  	return nil
  }
docs: // UpdateManifest updates the given pod manifest in the given path atomically on the file system.
  // The pod manifest has to be locked using LockManifest first to avoid races in case of concurrent writes.