Ubuntu Pastebin

Paste from mwhudson at Mon, 11 Jan 2016 03:07:53 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
mwhudson@DEVAC01:~/gopath/src/github.com/juju/juju$ git diff
diff --git a/container/image.go b/container/image.go
index 92a3d5f..1830028 100644
--- a/container/image.go
+++ b/container/image.go
@@ -5,10 +5,7 @@ package container
 
 import (
        "fmt"
-       "os"
-       "os/exec"
        "path"
-       "strings"
 
        "github.com/juju/errors"
 
@@ -67,25 +64,5 @@ func (ug *imageURLGetter) CACert() []byte {
 // ImageDownloadURL determines the public URL which can be used to obtain an
 // image blob with the specified parameters.
 func ImageDownloadURL(kind instance.ContainerType, series, arch, cloudimgBaseUrl string) (string, error) {
-       // TODO - we currently only need to support LXC images - kind is ignored.
-       if kind != instance.LXC {
-               return "", errors.Errorf("unsupported container type: %v", kind)
-       }
-
-       // Use the ubuntu-cloudimg-query command to get the url from which to fetch the image.
-       // This will be somewhere on http://cloud-images.ubuntu.com.
-       cmd := exec.Command("ubuntu-cloudimg-query", series, "released", arch, "--format", "%{url}")
-       if cloudimgBaseUrl != "" {
-               // If the base url isn't specified, we don't need to copy the current
-               // environment, because this is the default behaviour of the exec package.
-               cmd.Env = append(os.Environ(), fmt.Sprintf("UBUNTU_CLOUDIMG_QUERY_BASEURL=%s", cloudimgBaseUrl))
-       }
-       urlBytes, err := cmd.CombinedOutput()
-       if err != nil {
-               stderr := string(urlBytes)
-               return "", errors.Annotatef(err, "cannot determine LXC image URL: %v", stderr)
-       }
-       logger.Debugf("%s image for %s (%s) is %s", kind, series, arch, urlBytes)
-       imageURL := strings.Replace(string(urlBytes), ".tar.gz", "-root.tar.gz", -1)
-       return imageURL, nil
+       return "http://localhost/xenial-lxc.tar.gz", nil
 }
Download as text