~go-bot/juju-core/trunk

« back to all changes in this revision

Viewing changes to environs/manual/init.go

[r=dimitern],[bug=1221134] various: production code and logging improvements

Fixed 4 slightly annoying, unrelated minor issues:
1. Refactored production code not to depend on
gocheck (manual provider and apiserver/charms).
As a drive-by fix, I refactored environs/manual
tests to be proper black-box unit tests, rather
than white-box tests in the manual package.
2. Fixed and improved tools download output via
curl and better handling of errors.
3. Added debug logging to environs sshstorage and
httpstorage, and the manual provider.
4. Reformatted and unified generated boilerplate
config across all providers, fixing bug #1221134 in
the process (-e env not properly explained).

Changes tested live with a manual and local environs
with added manually provisioned machines.

While testing I found out and filed this bug #1291292
(basically manual bootstrap is broken with ssl-hostname-
verification set to false, but this is due to a deeper
issue).

I tried to unify and fix when all commands report
"environment not bootstrapped", consistently across
providers, but it turned out like more work than I
originally thought, so I'll do a follow-up on that
(which will entail dropping support for 1.14 environments
without a .jenv file).

https://codereview.appspot.com/72860045/

R=jameinel, rogpeppe

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
        "launchpad.net/juju-core/utils/ssh"
17
17
)
18
18
 
 
19
// detectionScript is the script to run on the remote machine to
 
20
// detect the OS series and hardware characteristics.
 
21
const detectionScript = `#!/bin/bash
 
22
set -e
 
23
lsb_release -cs
 
24
uname -m
 
25
grep MemTotal /proc/meminfo
 
26
cat /proc/cpuinfo`
 
27
 
19
28
// checkProvisionedScript is the script to run on the remote machine
20
29
// to check if a machine has already been provisioned.
21
30
//
132
141
        {regexp.MustCompile("ppc64el|ppc64le"), "ppc64"},
133
142
}
134
143
 
135
 
const detectionScript = `#!/bin/bash
136
 
set -e
137
 
lsb_release -cs
138
 
uname -m
139
 
grep MemTotal /proc/meminfo
140
 
cat /proc/cpuinfo`
141
 
 
142
144
// InitUbuntuUser adds the ubuntu user if it doesn't
143
145
// already exist, updates its ~/.ssh/authorized_keys,
144
146
// and enables passwordless sudo for it.