Improve code styles and fix after Harbor refactoring

Signed-off-by: 陈德 <chende@caicloud.io>
This commit is contained in:
陈德 2018-10-08 19:23:45 +08:00
parent 03d5157eaf
commit b648084d95
6 changed files with 9 additions and 9 deletions

View File

@ -1139,7 +1139,7 @@ paths:
parameters:
- name: request
in: body
description: reqeust to given source image and target tag
description: Request to give source image and target tag.
required: true
schema:
$ref: '#/definitions/RetagReq'
@ -1149,7 +1149,7 @@ paths:
'200':
description: Image retag successfully.
'400':
description: Invalid image values provided
description: Invalid image values provided.
'401':
description: User has no permission to the source project or destination project.
'404':

View File

@ -1,4 +1,4 @@
// Copyright (c) 2017 VMware, Inc. All Rights Reserved.
// Copyright Project Harbor Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@ -38,7 +38,7 @@ type Image struct {
func ParseImage(image string) (*Image, error) {
repo := strings.SplitN(image, "/", 2)
if len(repo) < 2 {
return nil, fmt.Errorf("unable to parse image from string: %s", image)
return nil, fmt.Errorf("Unable to parse image from string: %s", image)
}
i := strings.SplitN(repo[1], ":", 2)
res := &Image{

View File

@ -1,4 +1,4 @@
// Copyright (c) 2017 VMware, Inc. All Rights Reserved.
// Copyright Project Harbor Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
@ -68,7 +68,7 @@ func TestParseImage(t *testing.T) {
}
} else {
if err != nil {
t.Errorf("expect to parse %s fail, but not", c.Input)
t.Errorf("failed to parse image %s", c.Input)
}
}
}

View File

@ -257,7 +257,7 @@ func ping(client *http.Client, endpoint string) (string, string, error) {
}
}
log.Warningf("schemas %v are unsupported", challenges)
log.Warningf("Schemas %v are unsupported", challenges)
return "", "", nil
}

View File

@ -491,7 +491,7 @@ func (ra *RepositoryAPI) Retag() {
}
// Retag the image
if err = uiutils.Retag(srcImage, &models.Image{
if err = coreutils.Retag(srcImage, &models.Image{
Project: project,
Repo: repo,
Tag: request.Tag,

View File

@ -1,4 +1,4 @@
// Copyright (c) 2017 VMware, Inc. All Rights Reserved.
// Copyright Project Harbor Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.