~ubuntu-branches/ubuntu/saucy/juju-core/saucy-proposed

« back to all changes in this revision

Viewing changes to src/launchpad.net/juju-core/environs/dummy/storage.go

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2013-07-11 17:18:27 UTC
  • mfrom: (1.1.1)
  • Revision ID: package-import@ubuntu.com-20130711171827-vjqkg40r0dlf7ys2
Tags: 1.11.2-0ubuntu1
* New upstream release.
* Make juju-core the default juju (LP: #1190634):
  - d/control: Add virtual package juju -> juju-core.
  - d/juju-core.postinst.in: Bump priority of alternatives over that of
    python juju packages.
* Enable for all architectures (LP: #1172505):
  - d/control: Version BD on golang-go to >= 2:1.1.1 to ensure CGO
    support for non-x86 archs, make juju-core Arch: any.
  - d/README.source: Dropped - no longer required.
* d/watch: Updated for new upstream tarball naming.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// Copyright 2012, 2013 Canonical Ltd.
 
2
// Licensed under the AGPLv3, see LICENCE file for details.
 
3
 
1
4
package dummy
2
5
 
3
6
import (
6
9
        "io"
7
10
        "io/ioutil"
8
11
        "launchpad.net/juju-core/environs"
 
12
        "launchpad.net/juju-core/errors"
9
13
        "net/http"
10
14
        "sort"
11
15
        "strings"
78
82
        }
79
83
        data, ok := s.files[path]
80
84
        if !ok {
81
 
                return nil, &environs.NotFoundError{fmt.Errorf("file %q not found", path)}
 
85
                return nil, errors.NotFoundf("file %q not found", path)
82
86
        }
83
87
        return data, nil
84
88
}
88
92
}
89
93
 
90
94
func (s *storage) Put(name string, r io.Reader, length int64) error {
 
95
        // Allow Put to be poisoned as well.
 
96
        if err := s.poisoned[name]; err != nil {
 
97
                return err
 
98
        }
 
99
 
91
100
        // We only log Put requests on private storage.
92
101
        if strings.HasSuffix(s.path, "/private") {
93
 
                s.state.ops <- OpPutFile{s.state.name}
 
102
                s.state.ops <- OpPutFile{s.state.name, name}
94
103
        }
95
104
        var buf bytes.Buffer
96
105
        _, err := io.Copy(&buf, r)