mirror of
				https://github.com/moby/moby.git
				synced 2022-11-09 12:21:53 -05:00 
			
		
		
		
	more review changes
Signed-off-by: Evan Hazlett <ejhazlett@gmail.com>
This commit is contained in:
		
							parent
							
								
									857e60c2f9
								
							
						
					
					
						commit
						669a9dbe7f
					
				
					 1 changed files with 4 additions and 3 deletions
				
			
		| 
						 | 
				
			
			@ -7,6 +7,7 @@ import (
 | 
			
		|||
	"strconv"
 | 
			
		||||
 | 
			
		||||
	"github.com/Sirupsen/logrus"
 | 
			
		||||
	"github.com/docker/docker/api/errors"
 | 
			
		||||
	"github.com/docker/docker/api/server/httputils"
 | 
			
		||||
	basictypes "github.com/docker/docker/api/types"
 | 
			
		||||
	"github.com/docker/docker/api/types/filters"
 | 
			
		||||
| 
						 | 
				
			
			@ -319,18 +320,18 @@ func (sr *swarmRouter) getSecret(ctx context.Context, w http.ResponseWriter, r *
 | 
			
		|||
func (sr *swarmRouter) updateSecret(ctx context.Context, w http.ResponseWriter, r *http.Request, vars map[string]string) error {
 | 
			
		||||
	var secret types.SecretSpec
 | 
			
		||||
	if err := json.NewDecoder(r.Body).Decode(&secret); err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
		return errors.NewBadRequestError(err)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	rawVersion := r.URL.Query().Get("version")
 | 
			
		||||
	version, err := strconv.ParseUint(rawVersion, 10, 64)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return fmt.Errorf("Invalid secret version '%s': %s", rawVersion, err.Error())
 | 
			
		||||
		return errors.NewBadRequestError(fmt.Errorf("invalid secret version"))
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	id := vars["id"]
 | 
			
		||||
	if err := sr.backend.UpdateSecret(id, version, secret); err != nil {
 | 
			
		||||
		return fmt.Errorf("Error updating secret: %s", err)
 | 
			
		||||
		return errors.NewErrorWithStatusCode(err, http.StatusInternalServerError)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return nil
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue