Merge lp:~thumper/juju-core/bootstrap-state-no-constraints-trunk into lp:~go-bot/juju-core/trunk

Proposed by Tim Penhey
Status: Merged
Merged at revision: 1982
Proposed branch: lp:~thumper/juju-core/bootstrap-state-no-constraints-trunk
Merge into: lp:~go-bot/juju-core/trunk
Diff against target: 102 lines (+74/-1)
2 files modified
environs/cloudinit/cloudinit.go (+5/-1)
environs/cloudinit/cloudinit_test.go (+69/-0)
To merge this branch: bzr merge lp:~thumper/juju-core/bootstrap-state-no-constraints-trunk
Reviewer Review Type Date Requested Status
Juju Engineering Pending
Review via email: mp+190851@code.launchpad.net

Commit message

Don't pass through empty constraints

If there are no constraints to pass through, cloud init has
  --constraints ''
It seems that somewhere in the process, the empty param is
getting missed and the following --debug param is getting
parsed as a constraint value.

The test is horrible, and all we really care about is the
jujud bootstrap-state line.

See also: lp:1239508 and lp:1239509

https://codereview.appspot.com/14494054/

Description of the change

Don't pass through empty constraints

If there are no constraints to pass through, cloud init has
  --constraints ''
It seems that somewhere in the process, the empty param is
getting missed and the following --debug param is getting
parsed as a constraint value.

The test is horrible, and all we really care about is the
jujud bootstrap-state line.

https://codereview.appspot.com/14494054/

To post a comment you must log in.
Revision history for this message
Tim Penhey (thumper) wrote :

Reviewers: mp+190851_code.launchpad.net,

Message:
Please take a look.

Description:
Don't pass through empty constraints

If there are no constraints to pass through, cloud init has
   --constraints ''
It seems that somewhere in the process, the empty param is
getting missed and the following --debug param is getting
parsed as a constraint value.

The test is horrible, and all we really care about is the
jujud bootstrap-state line.

https://code.launchpad.net/~thumper/juju-core/bootstrap-state-no-constraints/+merge/190851

(do not edit description out of merge proposal)

Please review this at https://codereview.appspot.com/14494054/

Affected files (+1542, -235 lines):
   A [revision details]
   M charm/repo.go
   M cmd/juju/addmachine.go
   M cmd/juju/addunit.go
   M cmd/juju/bootstrap.go
   M cmd/juju/bootstrap_test.go
   M cmd/juju/cmd_test.go
   M cmd/juju/constraints.go
   M cmd/juju/deploy.go
   M cmd/juju/get.go
   M cmd/juju/help_topics.go
   M cmd/juju/main.go
   M cmd/juju/main_test.go
   M cmd/juju/plugin.go
   M cmd/juju/plugin_test.go
   M cmd/output_test.go
   M cmd/plugins/juju-metadata/metadata.go
   M cmd/plugins/juju-metadata/metadataplugin_test.go
   A cmd/plugins/juju-metadata/signmetadata.go
   A cmd/plugins/juju-metadata/signmetadata_test.go
   M cmd/plugins/juju-metadata/validateimagemetadata.go
   M cmd/plugins/juju-metadata/validateimagemetadata_test.go
   M cmd/plugins/juju-metadata/validatetoolsmetadata.go
   M cmd/plugins/juju-metadata/validatetoolsmetadata_test.go
   M environs/cloudinit/cloudinit.go
   M environs/cloudinit/cloudinit_test.go
   M environs/config/config.go
   M environs/config/config_test.go
   M environs/configstore/disk.go
   M environs/filestorage/filestorage.go
   M environs/httpstorage/backend.go
   M environs/httpstorage/backend_test.go
   A environs/imagemetadata/export_test.go
   M environs/imagemetadata/simplestreams.go
   M environs/imagemetadata/simplestreams_test.go
   M environs/simplestreams/decode.go
   A environs/simplestreams/encode.go
   M environs/simplestreams/export_test.go
   M environs/simplestreams/simplestreams.go
   M environs/simplestreams/simplestreams_test.go
   M environs/simplestreams/testing/testing.go
   M environs/sshstorage/storage.go
   M environs/sshstorage/storage_test.go
   M environs/sync/sync.go
   M environs/sync/sync_test.go
   M environs/tools/export_test.go
   M environs/tools/simplestreams.go
   M environs/tools/simplestreams_test.go
   M juju/osenv/vars_nix.go
   M provider/maas/instance.go
   M provider/maas/instance_test.go
   M provider/openstack/provider.go
   A utils/file_unix.go
   A utils/file_windows.go
   M utils/fslock/fslock.go
   M utils/trivial.go
   A utils/zfile_windows.go
   M version/version.go
   M worker/addressupdater/machine_test.go
   M worker/addressupdater/updater.go
   M worker/uniter/jujuc/relation-get.go
   M worker/uniter/jujuc/relation-get_test.go

Revision history for this message
Tim Penhey (thumper) wrote :
Revision history for this message
Andrew Wilkins (axwalk) wrote :

LGTM. Should log a couple of bugs: one to investigate why the quotes are
lost, and one one to fix the testing situation.

https://codereview.appspot.com/14494054/diff/4001/environs/cloudinit/cloudinit_test.go
File environs/cloudinit/cloudinit_test.go (right):

https://codereview.appspot.com/14494054/diff/4001/environs/cloudinit/cloudinit_test.go#newcode123
environs/cloudinit/cloudinit_test.go:123: // NOTE: this is terrible,
only want to test part of the results...
Indeed :(

https://codereview.appspot.com/14494054/

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'environs/cloudinit/cloudinit.go'
2--- environs/cloudinit/cloudinit.go 2013-10-04 17:10:00 +0000
3+++ environs/cloudinit/cloudinit.go 2013-10-14 03:14:27 +0000
4@@ -221,13 +221,17 @@
5 if err != nil {
6 return nil, err
7 }
8+ cons := cfg.Constraints.String()
9+ if cons != "" {
10+ cons = " --constraints " + shquote(cons)
11+ }
12 c.AddScripts(
13 fmt.Sprintf("echo %s > %s", shquote(cfg.StateInfoURL), BootstrapStateURLFile),
14 // The bootstrapping is always run with debug on.
15 cfg.jujuTools()+"/jujud bootstrap-state"+
16 " --data-dir "+shquote(cfg.DataDir)+
17 " --env-config "+shquote(base64yaml(cfg.Config))+
18- " --constraints "+shquote(cfg.Constraints.String())+
19+ cons+
20 " --debug",
21 "rm -rf "+shquote(acfg.Dir()),
22 )
23
24=== modified file 'environs/cloudinit/cloudinit_test.go'
25--- environs/cloudinit/cloudinit_test.go 2013-10-03 09:45:30 +0000
26+++ environs/cloudinit/cloudinit_test.go 2013-10-14 03:14:27 +0000
27@@ -120,6 +120,75 @@
28 start jujud-machine-0
29 `,
30 }, {
31+ // NOTE: this is terrible, only want to test part of the results...
32+ // precise state server - no constraints
33+ cfg: cloudinit.MachineConfig{
34+ MachineId: "0",
35+ AuthorizedKeys: "sshkey1",
36+ AgentEnvironment: map[string]string{agent.ProviderType: "dummy"},
37+ // precise currently needs mongo from PPA
38+ Tools: newSimpleTools("1.2.3-precise-amd64"),
39+ StateServer: true,
40+ StateServerCert: serverCert,
41+ StateServerKey: serverKey,
42+ StatePort: 37017,
43+ APIPort: 17070,
44+ MachineNonce: "FAKE_NONCE",
45+ StateInfo: &state.Info{
46+ Password: "arble",
47+ CACert: []byte("CA CERT\n" + testing.CACert),
48+ },
49+ APIInfo: &api.Info{
50+ Password: "bletch",
51+ CACert: []byte("CA CERT\n" + testing.CACert),
52+ },
53+ DataDir: environs.DataDir,
54+ StateInfoURL: "some-url",
55+ },
56+ setEnvConfig: true,
57+ expectScripts: `
58+echo ENABLE_MONGODB="no" > /etc/default/mongodb
59+set -xe
60+mkdir -p /var/lib/juju
61+mkdir -p /var/log/juju
62+bin='/var/lib/juju/tools/1\.2\.3-precise-amd64'
63+mkdir -p \$bin
64+wget --no-verbose -O \$bin/tools\.tar\.gz 'http://foo\.com/tools/releases/juju1\.2\.3-precise-amd64\.tgz'
65+sha256sum \$bin/tools\.tar\.gz > \$bin/juju1\.2\.3-precise-amd64\.sha256
66+grep '1234' \$bin/juju1\.2\.3-precise-amd64.sha256 \|\| \(echo "Tools checksum mismatch"; exit 1\)
67+tar zxf \$bin/tools.tar.gz -C \$bin
68+rm \$bin/tools\.tar\.gz && rm \$bin/juju1\.2\.3-precise-amd64\.sha256
69+printf %s '{"version":"1\.2\.3-precise-amd64","url":"http://foo\.com/tools/releases/juju1\.2\.3-precise-amd64\.tgz","sha256":"1234","size":10}' > \$bin/downloaded-tools\.txt
70+install -m 600 /dev/null '/etc/rsyslog\.d/25-juju\.conf'
71+printf '%s\\n' '\\n\$ModLoad imfile\\n\\n\$InputFileStateFile /var/spool/rsyslog/juju-machine-0-state\\n\$InputFilePersistStateInterval 50\\n\$InputFilePollInterval 5\\n\$InputFileName /var/log/juju/machine-0\.log\\n\$InputFileTag local-juju-machine-0:\\n\$InputFileStateFile machine-0\\n\$InputRunFileMonitor\\n\\n\$ModLoad imudp\\n\$UDPServerRun 514\\n\\n# Messages received from remote rsyslog machines contain a leading space so we\\n# need to account for that.\\n\$template JujuLogFormatLocal,\"%HOSTNAME%:%msg:::drop-last-lf%\\n\"\\n\$template JujuLogFormat,\"%HOSTNAME%:%msg:2:2048:drop-last-lf%\\n\"\\n\\n:syslogtag, startswith, \"juju-\" /var/log/juju/all-machines\.log;JujuLogFormat\\n& ~\\n:syslogtag, startswith, \"local-juju-\" /var/log/juju/all-machines\.log;JujuLogFormatLocal\\n& ~\\n' > '/etc/rsyslog\.d/25-juju\.conf'
72+restart rsyslog
73+mkdir -p '/var/lib/juju/agents/machine-0'
74+install -m 644 /dev/null '/var/lib/juju/agents/machine-0/format'
75+printf '%s\\n' '.*' > '/var/lib/juju/agents/machine-0/format'
76+install -m 600 /dev/null '/var/lib/juju/agents/machine-0/agent\.conf'
77+printf '%s\\n' '.*' > '/var/lib/juju/agents/machine-0/agent\.conf'
78+install -m 600 /dev/null '/var/lib/juju/server\.pem'
79+printf '%s\\n' 'SERVER CERT\\n[^']*SERVER KEY\\n[^']*' > '/var/lib/juju/server\.pem'
80+mkdir -p /var/lib/juju/db/journal
81+chmod 0700 /var/lib/juju/db
82+dd bs=1M count=1 if=/dev/zero of=/var/lib/juju/db/journal/prealloc\.0
83+dd bs=1M count=1 if=/dev/zero of=/var/lib/juju/db/journal/prealloc\.1
84+dd bs=1M count=1 if=/dev/zero of=/var/lib/juju/db/journal/prealloc\.2
85+cat >> /etc/init/juju-db\.conf << 'EOF'\\ndescription "juju state database"\\nauthor "Juju Team <juju@lists\.ubuntu\.com>"\\nstart on runlevel \[2345\]\\nstop on runlevel \[!2345\]\\nrespawn\\nnormal exit 0\\n\\nlimit nofile 65000 65000\\nlimit nproc 20000 20000\\n\\nexec /usr/bin/mongod --auth --dbpath=/var/lib/juju/db --sslOnNormalPorts --sslPEMKeyFile '/var/lib/juju/server\.pem' --sslPEMKeyPassword ignored --bind_ip 0\.0\.0\.0 --port 37017 --noprealloc --syslog --smallfiles\\nEOF\\n
86+start juju-db
87+mkdir -p '/var/lib/juju/agents/bootstrap'
88+install -m 644 /dev/null '/var/lib/juju/agents/bootstrap/format'
89+printf '%s\\n' '.*' > '/var/lib/juju/agents/bootstrap/format'
90+install -m 600 /dev/null '/var/lib/juju/agents/bootstrap/agent\.conf'
91+printf '%s\\n' '.*' > '/var/lib/juju/agents/bootstrap/agent\.conf'
92+echo 'some-url' > /tmp/provider-state-url
93+/var/lib/juju/tools/1\.2\.3-precise-amd64/jujud bootstrap-state --data-dir '/var/lib/juju' --env-config '[^']*' --debug
94+rm -rf '/var/lib/juju/agents/bootstrap'
95+ln -s 1\.2\.3-precise-amd64 '/var/lib/juju/tools/machine-0'
96+cat >> /etc/init/jujud-machine-0\.conf << 'EOF'\\ndescription "juju machine-0 agent"\\nauthor "Juju Team <juju@lists\.ubuntu\.com>"\\nstart on runlevel \[2345\]\\nstop on runlevel \[!2345\]\\nrespawn\\nnormal exit 0\\n\\nlimit nofile 20000 20000\\n\\nexec /var/lib/juju/tools/machine-0/jujud machine --data-dir '/var/lib/juju' --machine-id 0 --debug >> /var/log/juju/machine-0\.log 2>&1\\nEOF\\n
97+start jujud-machine-0
98+`,
99+ }, {
100 // raring state server
101 cfg: cloudinit.MachineConfig{
102 MachineId: "0",

Subscribers

People subscribed via source and target branches

to status/vote changes: