Comment 1 for bug 1271744

Revision history for this message
Diogo Matsubara (matsubara) wrote :

I got more info about this bug:

Today I actually read the documentation in juju-core/doc/simplestreams-metadata.txt and there it explains that the --metadata-source option needs a local directory that's accessible by the nodes. The current help for --metadata-source says:
--metadata-source (= "")
    local path to use as tools and/or metadata source
Private clouds may need to specify their own custom image metadata, and possibly upload
Juju tools to cloud storage if no outgoing Internet access is available. In this case,
use the --metadata-source paramater to tell bootstrap a local directory from which to
upload tools and/or image metadata.

So I just assume that juju would make some kind of magic to make the local directory file accessible to the bootstrapped node. So at a minimum this bug is about improve that documentation, but this is not the extra info I want to add.
Following the instruction in simplestreams-metadata.txt, I set up a local webserver to serve the metadata files to juju.

Created the metadata directory under /var/www/juju-metadata
Copied the 1.17.1-precise-amd64.tgz tarball from http://juju-dist.s3.amazonaws.com
Generated the metadata using metadata generate-tools option

$ wget -c http://juju-dist.s3.amazonaws.com/testing/tools/releases/juju-1.17.1-precise-amd64.tgz
$ sha256sum tools/releases/juju-1.17.1-precise-amd64.tgz
3c3c04ec40c2f52d1e5f9fa356825c91ce9bbfce92b4142e44827f32d8289753 tools/releases/juju-1.17.1-precise-amd64.tgz
I used sudo so juju would have permission to write to /var/www/juju-metadata
$ sudo juju --debug metadata generate-tools -d juju-metadata
$ juju --version
1.16.5-trusty-amd64
$ sudo cat juju-metadata/tools/streams/v1/com.ubuntu.juju\:released\:tools.json
{
    "products": {
        "com.ubuntu.juju:12.04:amd64": {
            "version": "1.17.1",
            "arch": "amd64",
            "versions": {
                "20142301": {
                    "items": {
                        "1.17.1-precise-amd64": {
                            "release": "precise",
                            "version": "1.17.1",
                            "arch": "amd64",
                            "size": 19,
                            "path": "releases/juju-1.17.1-precise-amd64.tgz",
                            "ftype": "tar.gz",
                            "sha256": "b16e15764b8bc06c5c3f9f19bc8b99fa48e7894aa5a6ccdad65da49bbf564793"
                        }
                    }
                }
            }
        }
    },
    "updated": "Thu, 23 Jan 2014 13:01:51 -0500",
    "format": "products:1.0"

Notice how the sha256 differ but I continued anyway.
Changed the permission of the generated index.json and com.ubuntu.juju:released:tools.json so they will be accessible through the webserver
$ sudo chmod 644 juju-metadata/tools/streams/v1/*

I logged into the Trusty VM where I tried to bootstrap MAAS:
# juju bootstrap --debug --metadata-source=http://10.98.3.20/juju-metadata/tools

and got this failure in the node's /var/log/cloud-init-output.log
...
Adding new user `mongodb' (UID 107) with group `nogroup' ...
Not creating home directory `/home/mongodb'.
Adding group `mongodb' (GID 114) ...
Done.
Adding user `mongodb' to group `mongodb' ...
Adding user mongodb to group mongodb
Done.
mongodb stop/waiting
Processing triggers for libc-bin ...
ldconfig deferred processing now taking place
+ mkdir -p /var/lib/juju
+ mkdir -p /var/log/juju
+ echo 'Fetching tools: wget --no-verbose -O $bin/tools.tar.gz '\''http://10.98.3.20/juju-metadata/tools/releases/juju-1.17.1-precise-amd64.tgz'\'''
+ bin=/var/lib/juju/tools/1.17.1-precise-amd64
+ mkdir -p /var/lib/juju/tools/1.17.1-precise-amd64
+ wget --no-verbose -O /var/lib/juju/tools/1.17.1-precise-amd64/tools.tar.gz http://10.98.3.20/juju-metadata/tools/releases/juju-1.17.1-precise-amd64.tgz
2014-01-23 16:48:18 URL:http://10.98.3.20/juju-metadata/tools/releases/juju-1.17.1-precise-amd64.tgz [5209799/5209799] -> "/var/lib/juju/tools/1.17.1-precise-amd64/tools.tar.gz" [1]
+ sha256sum /var/lib/juju/tools/1.17.1-precise-amd64/tools.tar.gz
+ grep b16e15764b8bc06c5c3f9f19bc8b99fa48e7894aa5a6ccdad65da49bbf564793 /var/lib/juju/tools/1.17.1-precise-amd64/juju1.17.1-precise-amd64.sha256
+ echo 'Tools checksum mismatch'
Tools checksum mismatch
+ exit 1

Broadcast message from root@6bgr7
        (unknown) at 16:48 ...

The system is going down for halt NOW!
Power button pressed

So, I don't know exactly what I did wrong, but the generated metadata has a different sha256 checksum than the one from the file I downloaded from s3.