Skip to content

Commit

Permalink
volcli/volcli.go: adjust snapshot copy command to return the new volu…
Browse files Browse the repository at this point in the history
…me name.

Signed-off-by: Erik Hollensbe <github@hollensbe.org>
  • Loading branch information
Erik Hollensbe committed Aug 16, 2016
1 parent 0df3e03 commit fed718f
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions volcli/volcli.go
Expand Up @@ -17,6 +17,7 @@ import (
"github.com/codegangsta/cli"
"github.com/contiv/errored"
"github.com/contiv/volplugin/config"
"github.com/contiv/volplugin/errors"
"github.com/contiv/volplugin/lock"
"github.com/contiv/volplugin/watch"
"github.com/kr/pty"
Expand Down Expand Up @@ -726,6 +727,18 @@ func volumeSnapshotCopy(ctx *cli.Context) (bool, error) {
return false, errored.Errorf("Volume %v Response Status Code was %d, not 200", qualifiedVolume, resp.StatusCode)
}

content, err = ioutil.ReadAll(resp.Body)
if err != nil {
return false, errored.New("Reading body processing response").Combine(err)
}

vol := &config.Volume{}
if err := json.Unmarshal(content, vol); err != nil {
return false, errors.UnmarshalVolume.Combine(err)
}

fmt.Println(strings.Join([]string{vol.PolicyName, vol.VolumeName}, "/"))

return false, nil
}

Expand Down

0 comments on commit fed718f

Please sign in to comment.