Signed-off-by: Alexandr Morozov <lk4d4math@gmail.com>
| ... | ... |
@@ -80,10 +80,9 @@ func (s *TagStore) pullRepository(r *registry.Session, out io.Writer, localName, |
| 80 | 80 |
if err != nil {
|
| 81 | 81 |
if strings.Contains(err.Error(), "HTTP code: 404") {
|
| 82 | 82 |
return fmt.Errorf("Error: image %s not found", remoteName)
|
| 83 |
- } else {
|
|
| 84 |
- // Unexpected HTTP error |
|
| 85 |
- return err |
|
| 86 | 83 |
} |
| 84 |
+ // Unexpected HTTP error |
|
| 85 |
+ return err |
|
| 87 | 86 |
} |
| 88 | 87 |
|
| 89 | 88 |
log.Debugf("Retrieving the tag list")
|
| ... | ... |
@@ -18,8 +18,8 @@ import ( |
| 18 | 18 |
func (s *TagStore) getImageList(localRepo map[string]string, requestedTag string) ([]string, map[string][]string, error) {
|
| 19 | 19 |
var ( |
| 20 | 20 |
imageList []string |
| 21 |
- imagesSeen map[string]bool = make(map[string]bool) |
|
| 22 |
- tagsByImage map[string][]string = make(map[string][]string) |
|
| 21 |
+ imagesSeen = make(map[string]bool) |
|
| 22 |
+ tagsByImage = make(map[string][]string) |
|
| 23 | 23 |
) |
| 24 | 24 |
|
| 25 | 25 |
for tag, id := range localRepo {
|
| ... | ... |
@@ -170,12 +170,11 @@ func (s *TagStore) CmdTarLayer(job *engine.Job) engine.Status {
|
| 170 | 170 |
} |
| 171 | 171 |
defer fs.Close() |
| 172 | 172 |
|
| 173 |
- if written, err := io.Copy(job.Stdout, fs); err != nil {
|
|
| 173 |
+ written, err := io.Copy(job.Stdout, fs) |
|
| 174 |
+ if err != nil {
|
|
| 174 | 175 |
return job.Error(err) |
| 175 |
- } else {
|
|
| 176 |
- log.Debugf("rendered layer for %s of [%d] size", image.ID, written)
|
|
| 177 | 176 |
} |
| 178 |
- |
|
| 177 |
+ log.Debugf("rendered layer for %s of [%d] size", image.ID, written)
|
|
| 179 | 178 |
return engine.StatusOK |
| 180 | 179 |
} |
| 181 | 180 |
return job.Errorf("No such image: %s", name)
|
| ... | ... |
@@ -288,42 +288,42 @@ func validateTagName(name string) error {
|
| 288 | 288 |
return nil |
| 289 | 289 |
} |
| 290 | 290 |
|
| 291 |
-func (s *TagStore) poolAdd(kind, key string) (chan struct{}, error) {
|
|
| 292 |
- s.Lock() |
|
| 293 |
- defer s.Unlock() |
|
| 291 |
+func (store *TagStore) poolAdd(kind, key string) (chan struct{}, error) {
|
|
| 292 |
+ store.Lock() |
|
| 293 |
+ defer store.Unlock() |
|
| 294 | 294 |
|
| 295 |
- if c, exists := s.pullingPool[key]; exists {
|
|
| 295 |
+ if c, exists := store.pullingPool[key]; exists {
|
|
| 296 | 296 |
return c, fmt.Errorf("pull %s is already in progress", key)
|
| 297 | 297 |
} |
| 298 |
- if c, exists := s.pushingPool[key]; exists {
|
|
| 298 |
+ if c, exists := store.pushingPool[key]; exists {
|
|
| 299 | 299 |
return c, fmt.Errorf("push %s is already in progress", key)
|
| 300 | 300 |
} |
| 301 | 301 |
|
| 302 | 302 |
c := make(chan struct{})
|
| 303 | 303 |
switch kind {
|
| 304 | 304 |
case "pull": |
| 305 |
- s.pullingPool[key] = c |
|
| 305 |
+ store.pullingPool[key] = c |
|
| 306 | 306 |
case "push": |
| 307 |
- s.pushingPool[key] = c |
|
| 307 |
+ store.pushingPool[key] = c |
|
| 308 | 308 |
default: |
| 309 | 309 |
return nil, fmt.Errorf("Unknown pool type")
|
| 310 | 310 |
} |
| 311 | 311 |
return c, nil |
| 312 | 312 |
} |
| 313 | 313 |
|
| 314 |
-func (s *TagStore) poolRemove(kind, key string) error {
|
|
| 315 |
- s.Lock() |
|
| 316 |
- defer s.Unlock() |
|
| 314 |
+func (store *TagStore) poolRemove(kind, key string) error {
|
|
| 315 |
+ store.Lock() |
|
| 316 |
+ defer store.Unlock() |
|
| 317 | 317 |
switch kind {
|
| 318 | 318 |
case "pull": |
| 319 |
- if c, exists := s.pullingPool[key]; exists {
|
|
| 319 |
+ if c, exists := store.pullingPool[key]; exists {
|
|
| 320 | 320 |
close(c) |
| 321 |
- delete(s.pullingPool, key) |
|
| 321 |
+ delete(store.pullingPool, key) |
|
| 322 | 322 |
} |
| 323 | 323 |
case "push": |
| 324 |
- if c, exists := s.pushingPool[key]; exists {
|
|
| 324 |
+ if c, exists := store.pushingPool[key]; exists {
|
|
| 325 | 325 |
close(c) |
| 326 |
- delete(s.pushingPool, key) |
|
| 326 |
+ delete(store.pushingPool, key) |
|
| 327 | 327 |
} |
| 328 | 328 |
default: |
| 329 | 329 |
return fmt.Errorf("Unknown pool type")
|
| ... | ... |
@@ -653,9 +653,8 @@ func ValidateContextDirectory(srcPath string, excludes []string) error {
|
| 653 | 653 |
if err != nil && os.IsPermission(err) {
|
| 654 | 654 |
finalError = fmt.Errorf("no permission to read from '%s'", filePath)
|
| 655 | 655 |
return err |
| 656 |
- } else {
|
|
| 657 |
- currentFile.Close() |
|
| 658 | 656 |
} |
| 657 |
+ currentFile.Close() |
|
| 659 | 658 |
} |
| 660 | 659 |
return nil |
| 661 | 660 |
}) |