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

Delta Between Two Patch Sets: container/lxc/initialisation.go

Issue 72270044: lxc: Fixed target-release issue precise/maas
Left Patch Set: cloudinit: Fixed target-release issue precise/maas Created 11 years, 1 month ago
Right Patch Set: lxc: Fixed target-release issue precise/maas Created 11 years, 1 month 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:
Right: Side by side diff | Download
LEFTRIGHT
(no file at all)
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 lxc 4 package lxc
5 5
6 import ( 6 import (
7 "launchpad.net/juju-core/container" 7 "launchpad.net/juju-core/container"
8 "launchpad.net/juju-core/utils" 8 "launchpad.net/juju-core/utils"
9 ) 9 )
10 10
11 var requiredPackages = []string{ 11 var requiredPackages = []string{
12 "lxc", 12 "lxc",
13 } 13 }
14 14
15 type containerInitialiser struct{} 15 type containerInitialiser struct {
16 » series string
17 }
16 18
17 // containerInitialiser implements container.Initialiser. 19 // containerInitialiser implements container.Initialiser.
18 var _ container.Initialiser = (*containerInitialiser)(nil) 20 var _ container.Initialiser = (*containerInitialiser)(nil)
19 21
20 // NewContainerInitialiser returns an instance used to perform the steps 22 // NewContainerInitialiser returns an instance used to perform the steps
21 // required to allow a host machine to run a LXC container. 23 // required to allow a host machine to run a LXC container.
22 func NewContainerInitialiser() container.Initialiser { 24 func NewContainerInitialiser(series string) container.Initialiser {
23 » return &containerInitialiser{} 25 » return &containerInitialiser{series}
24 } 26 }
25 27
26 // Initialise is specified on the container.Initialiser interface. 28 // Initialise is specified on the container.Initialiser interface.
27 func (ci *containerInitialiser) Initialise() error { 29 func (ci *containerInitialiser) Initialise() error {
28 » return ensureDependencies() 30 » return ensureDependencies(ci.series)
29 } 31 }
30 32
31 func ensureDependencies() error { 33 // ensureDependencies creates a set of install packages using AptGetPreparePacka ges
32 » return utils.AptGetInstall(requiredPackages...) 34 // and runs each set of packages through AptGetInstall
35 func ensureDependencies(series string) error {
36 » var err error
37 » aptGetInstallCommandList := utils.AptGetPreparePackages(requiredPackages , series)
38 » for _, commands := range aptGetInstallCommandList {
39 » » err = utils.AptGetInstall(commands...)
40 » » if err != nil {
41 » » » return err
42 » » }
43 » }
44 » return err
33 } 45 }
LEFTRIGHT

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