~juju-qa/ubuntu/xenial/juju/xenial-2.0-beta3

« back to all changes in this revision

Viewing changes to src/github.com/juju/juju/cmd/plugins/juju-upgrade-mongo/upgrade.go

  • Committer: Martin Packman
  • Date: 2016-03-30 19:31:08 UTC
  • mfrom: (1.1.41)
  • Revision ID: martin.packman@canonical.com-20160330193108-h9iz3ak334uk0z5r
Merge new upstream source 2.0~beta3

Show diffs side-by-side

added added

removed removed

Lines of Context:
13
13
        "text/template"
14
14
        "time"
15
15
 
16
 
        "launchpad.net/gnuflag"
17
 
 
18
16
        "github.com/juju/cmd"
19
17
        "github.com/juju/errors"
 
18
        "github.com/juju/names"
 
19
        "github.com/juju/replicaset"
 
20
        "github.com/juju/utils"
 
21
        "launchpad.net/gnuflag"
 
22
 
20
23
        "github.com/juju/juju/api/highavailability"
21
24
        "github.com/juju/juju/apiserver/params"
22
25
        "github.com/juju/juju/cmd/modelcmd"
23
26
        "github.com/juju/juju/juju"
24
27
        "github.com/juju/juju/mongo"
25
28
        "github.com/juju/juju/network"
26
 
        "github.com/juju/loggo"
27
 
        "github.com/juju/names"
28
 
        "github.com/juju/replicaset"
29
 
        "github.com/juju/utils"
30
29
)
31
30
 
32
31
func (c *upgradeMongoCommand) SetFlags(f *gnuflag.FlagSet) {
54
53
 
55
54
const upgradeDoc = `This command upgrades the version of mongo used to store the Juju model from 2.4 to 3.x`
56
55
 
57
 
var logger = loggo.GetLogger("juju.plugins.upgrademongo")
58
 
 
59
56
// MongoUpgradeClient defines the methods
60
57
// on the client api that mongo upgrade will call.
61
58
type MongoUpgradeClient interface {
80
77
        }
81
78
}
82
79
 
83
 
func mustParseTemplate(templ string) *template.Template {
84
 
        t := template.New("").Funcs(template.FuncMap{
85
 
                "shquote": utils.ShQuote,
86
 
        })
87
 
        return template.Must(t.Parse(templ))
88
 
}
89
 
 
90
80
// runViaJujuSSH will run arbitrary code in the remote machine.
91
81
func runViaJujuSSH(machine, script string, stdout, stderr *bytes.Buffer) error {
92
82
        cmd := exec.Command("ssh", []string{"-o StrictHostKeyChecking=no", fmt.Sprintf("ubuntu@%s", machine), "sudo -n bash -c " + utils.ShQuote(script)}...)
269
259
 
270
260
        return result, nil
271
261
}
272
 
 
273
 
// waitForNotified will wait for all ha members to be notified
274
 
// of the impending migration or timeout.
275
 
func waitForNotified(addrs []string) error {
276
 
        return nil
277
 
}
278
 
 
279
 
// stopAllMongos stops all the mongo slaves to prevent them
280
 
// from falling back when we upgrade the master.
281
 
func stopAllMongos(addrs []string) error {
282
 
        return nil
283
 
}
284
 
 
285
 
// recreateReplicas creates replica slaves again from the
286
 
// upgraded mongo master.
287
 
func recreateReplicas(master string, addrs []string) error {
288
 
        return nil
289
 
}