Skip to content

Commit

Permalink
Merge pull request #3724 from davecheney/upgrade-yaml-v2
Browse files Browse the repository at this point in the history
all: upgrade to yaml.v2

- utils: switch to yaml.v2
  Update tests expecting the previous error output.
- all: remove juju/utils.go yaml fork, revert to juju/utils repo
  Removes the last file from juju/juju/utils, so remove that package.


(Review request: http://reviews.vapour.ws/r/3130/)
  • Loading branch information
jujubot committed Nov 18, 2015
2 parents d7092bd + d0cb1b7 commit 9d8b143
Show file tree
Hide file tree
Showing 13 changed files with 15 additions and 97 deletions.
4 changes: 2 additions & 2 deletions provider/maas/util.go
Expand Up @@ -9,13 +9,13 @@ import (
"strings"

"github.com/juju/errors"
goyaml "gopkg.in/yaml.v2" // TODO(dfc) this is horridly wrong, utils.ReadYaml requires yaml.v1
"github.com/juju/utils"
goyaml "gopkg.in/yaml.v2"

"github.com/juju/juju/cloudconfig/cloudinit"
"github.com/juju/juju/environs/config"
"github.com/juju/juju/instance"
"github.com/juju/juju/juju/paths"
"github.com/juju/juju/utils"
)

// extractSystemId extracts the 'system_id' part from an InstanceId.
Expand Down
2 changes: 1 addition & 1 deletion storage/provider/tmpfs.go
Expand Up @@ -10,10 +10,10 @@ import (

"github.com/juju/errors"
"github.com/juju/names"
"github.com/juju/utils"

"github.com/juju/juju/environs/config"
"github.com/juju/juju/storage"
"github.com/juju/juju/utils"
)

const (
Expand Down
14 changes: 0 additions & 14 deletions utils/package_test.go

This file was deleted.

65 changes: 0 additions & 65 deletions utils/yaml.go

This file was deleted.

3 changes: 1 addition & 2 deletions worker/meterstatus/state.go
Expand Up @@ -8,8 +8,7 @@ import (
"time"

"github.com/juju/errors"

"github.com/juju/juju/utils"
"github.com/juju/utils"
)

// StateFile holds the meter status on disk.
Expand Down
3 changes: 1 addition & 2 deletions worker/uniter/charm/charm.go
Expand Up @@ -8,10 +8,9 @@ import (
"net/url"

"github.com/juju/loggo"
"github.com/juju/utils"
"github.com/juju/utils/set"
"gopkg.in/juju/charm.v6-unstable"

"github.com/juju/juju/utils"
)

var logger = loggo.GetLogger("juju.worker.uniter.charm")
Expand Down
6 changes: 2 additions & 4 deletions worker/uniter/charm/manifest_deployer.go
Expand Up @@ -8,11 +8,9 @@ import (
"os"
"path/filepath"

jujuutils "github.com/juju/utils"
"github.com/juju/utils"
"github.com/juju/utils/set"
"gopkg.in/juju/charm.v6-unstable"

"github.com/juju/juju/utils"
)

const (
Expand Down Expand Up @@ -149,7 +147,7 @@ func (d *manifestDeployer) finishDeploy() error {
logger.Debugf("finishing deploy of charm %q", d.staged.url)
oldPath := d.CharmPath(deployingURLPath)
newPath := d.CharmPath(charmURLPath)
return jujuutils.ReplaceFile(oldPath, newPath)
return utils.ReplaceFile(oldPath, newPath)
}

// ensureBaseFiles checks for an interrupted deploy operation and, if it finds
Expand Down
2 changes: 1 addition & 1 deletion worker/uniter/operation/state.go
Expand Up @@ -7,9 +7,9 @@ import (
"os"

"github.com/juju/errors"
"github.com/juju/utils"
"gopkg.in/juju/charm.v6-unstable"

"github.com/juju/juju/utils"
"github.com/juju/juju/worker/uniter/hook"
)

Expand Down
2 changes: 1 addition & 1 deletion worker/uniter/relation/state.go
Expand Up @@ -14,9 +14,9 @@ import (
"strings"

"github.com/juju/errors"
"github.com/juju/utils"
"gopkg.in/juju/charm.v6-unstable/hooks"

"github.com/juju/juju/utils"
"github.com/juju/juju/worker/uniter/hook"
)

Expand Down
2 changes: 1 addition & 1 deletion worker/uniter/relation/state_test.go
Expand Up @@ -74,7 +74,7 @@ var badRelationsTests = []struct {
`.* (is a directory|handle is invalid.)`,
}, {
map[string]string{"foo-1": "'"}, nil,
`invalid unit file "foo-1": YAML error: .*`,
`invalid unit file "foo-1": yaml: found unexpected end of stream`,
}, {
map[string]string{"foo-1": "blah: blah\n"}, nil,
`invalid unit file "foo-1": "changed-version" not set`,
Expand Down
2 changes: 1 addition & 1 deletion worker/uniter/storage/state.go
Expand Up @@ -11,9 +11,9 @@ import (

"github.com/juju/errors"
"github.com/juju/names"
"github.com/juju/utils"
"gopkg.in/juju/charm.v6-unstable/hooks"

"github.com/juju/juju/utils"
"github.com/juju/juju/worker/uniter/hook"
)

Expand Down
5 changes: 3 additions & 2 deletions worker/uniter/storage/state_test.go
Expand Up @@ -76,7 +76,8 @@ func (s *stateSuite) TestReadAllStateFilesOneBadApple(c *gc.C) {
dir := c.MkDir()
writeFile(c, filepath.Join(dir, "data-0"), "rubbish")
_, err := storage.ReadAllStateFiles(dir)
c.Assert(err, gc.ErrorMatches, `cannot load storage state from ".*": cannot load storage "data/0" state from ".*": invalid storage state file ".*": missing 'attached'`)
c.Assert(err, gc.ErrorMatches, `cannot load storage state from ".*": cannot load storage "data/0" state from ".*": invalid storage state file ".*": yaml: unmarshal errors:
`+" line 1: cannot unmarshal !!str `rubbish` into storage.diskInfo")
}

func (s *stateSuite) TestReadAllStateFilesDirNotExist(c *gc.C) {
Expand Down Expand Up @@ -133,7 +134,7 @@ func (s *stateSuite) TestReadStateFileBadFormat(c *gc.C) {
dir := c.MkDir()
writeFile(c, filepath.Join(dir, "data-0"), "!@#")
_, err := storage.ReadStateFile(dir, names.NewStorageTag("data/0"))
c.Assert(err, gc.ErrorMatches, `cannot load storage "data/0" state from ".*": invalid storage state file ".*": YAML error: did not find expected whitespace or line break`)
c.Assert(err, gc.ErrorMatches, `cannot load storage "data/0" state from ".*": invalid storage state file ".*": yaml: did not find expected whitespace or line break`)

writeFile(c, filepath.Join(dir, "data-0"), "icantbelieveitsnotattached: true\n")
_, err = storage.ReadStateFile(dir, names.NewStorageTag("data/0"))
Expand Down
2 changes: 1 addition & 1 deletion worker/uniter/upgrade123.go
Expand Up @@ -7,9 +7,9 @@ import (
"os"

"github.com/juju/names"
"github.com/juju/utils"
"gopkg.in/juju/charm.v6-unstable/hooks"

"github.com/juju/juju/utils"
"github.com/juju/juju/worker/uniter/operation"
)

Expand Down

0 comments on commit 9d8b143

Please sign in to comment.