Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(302)

Side by Side Diff: environs/imagemetadata/generate.go

Issue 93410043: Extract errors package to github.com/juju/errors
Patch Set: Created 9 years, 10 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 Canonical Ltd. 1 // Copyright 2013 Canonical Ltd.
2 // Licensed under the AGPLv3, see LICENCE file for details. 2 // Licensed under the AGPLv3, see LICENCE file for details.
3 3
4 package imagemetadata 4 package imagemetadata
5 5
6 import ( 6 import (
7 "bytes" 7 "bytes"
8 "fmt" 8 "fmt"
9 "path/filepath" 9 "path/filepath"
10 "time" 10 "time"
11 11
12 "github.com/juju/errors"
13
12 "launchpad.net/juju-core/environs/simplestreams" 14 "launchpad.net/juju-core/environs/simplestreams"
13 "launchpad.net/juju-core/environs/storage" 15 "launchpad.net/juju-core/environs/storage"
14 "launchpad.net/juju-core/errors"
15 "launchpad.net/juju-core/version/ubuntu" 16 "launchpad.net/juju-core/version/ubuntu"
16 ) 17 )
17 18
18 // MergeAndWriteMetadata reads the existing metadata from storage (if any), 19 // MergeAndWriteMetadata reads the existing metadata from storage (if any),
19 // and merges it with supplied metadata, writing the resulting metadata is writt en to storage. 20 // and merges it with supplied metadata, writing the resulting metadata is writt en to storage.
20 func MergeAndWriteMetadata(series string, metadata []*ImageMetadata, cloudSpec * simplestreams.CloudSpec, 21 func MergeAndWriteMetadata(series string, metadata []*ImageMetadata, cloudSpec * simplestreams.CloudSpec,
21 metadataStore storage.Storage) error { 22 metadataStore storage.Storage) error {
22 23
23 existingMetadata, err := readMetadata(metadataStore) 24 existingMetadata, err := readMetadata(metadataStore)
24 if err != nil { 25 if err != nil {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 } 104 }
104 for _, md := range metadataInfo { 105 for _, md := range metadataInfo {
105 err = metadataStore.Put( 106 err = metadataStore.Put(
106 filepath.Join(storage.BaseImagesPath, md.Path), bytes.Ne wReader(md.Data), int64(len(md.Data))) 107 filepath.Join(storage.BaseImagesPath, md.Path), bytes.Ne wReader(md.Data), int64(len(md.Data)))
107 if err != nil { 108 if err != nil {
108 return err 109 return err
109 } 110 }
110 } 111 }
111 return nil 112 return nil
112 } 113 }
OLDNEW

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b