Merge lp:~axwalk/juju-core/lp1212148-cloudinit-printf into lp:~go-bot/juju-core/trunk

Proposed by Andrew Wilkins
Status: Merged
Approved by: Andrew Wilkins
Approved revision: no longer in the source branch.
Merged at revision: 1686
Proposed branch: lp:~axwalk/juju-core/lp1212148-cloudinit-printf
Merge into: lp:~go-bot/juju-core/trunk
Diff against target: 145 lines (+23/-16)
5 files modified
agent/agent.go (+1/-1)
cloudinit/cloudinit_test.go (+1/-1)
cloudinit/options.go (+8/-1)
container/lxc/lxc_test.go (+1/-1)
environs/cloudinit/cloudinit_test.go (+12/-12)
To merge this branch: bzr merge lp:~axwalk/juju-core/lp1212148-cloudinit-printf
Reviewer Review Type Date Requested Status
Juju Engineering Pending
Review via email: mp+181045@code.launchpad.net

Commit message

Use printf instead of echo shell builtin

When writing cloud-init config files, use
printf to write files rather than shell's
echo builtin. There are differences between
bash and dash's echo when it comes to
interpreting escape sequences (e.g. \n).
Thus, depending on the guest being spun up,
we could get different results for files
being created via the cloud-init runcmds.

We could potentially use /bin/echo, but
it's safer just to use printf(1).

https://codereview.appspot.com/13123043/

Description of the change

Use printf instead of echo shell builtin

When writing cloud-init config files, use
printf to write files rather than shell's
echo builtin. There are differences between
bash and dash's echo when it comes to
interpreting escape sequences (e.g. \n).
Thus, depending on the guest being spun up,
we could get different results for files
being created via the cloud-init runcmds.

We could potentially use /bin/echo, but
it's safer just to use printf(1).

https://codereview.appspot.com/13123043/

To post a comment you must log in.
Revision history for this message
Andrew Wilkins (axwalk) wrote :
Download full text (18.5 KiB)

Reviewers: mp+181045_code.launchpad.net,

Message:
Please take a look.

Description:
Use printf instead of echo shell builtin

When writing cloud-init config files, use
printf to write files rather than shell's
echo builtin. There are differences between
bash and dash's echo when it comes to
interpreting escape sequences (e.g. \n).
Thus, depending on the guest being spun up,
we could get different results for files
being created via the cloud-init runcmds.

We could potentially use /bin/echo, but
it's safer just to use printf(1).

https://code.launchpad.net/~axwalk/juju-core/lp1212148-cloudinit-printf/+merge/181045

(do not edit description out of merge proposal)

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

Affected files:
   A [revision details]
   M agent/agent.go
   M cloudinit/cloudinit_test.go
   M cloudinit/options.go
   M container/lxc/lxc_test.go
   M environs/cloudinit/cloudinit_test.go

Index: [revision details]
=== added file '[revision details]'
--- [revision details] 2012-01-01 00:00:00 +0000
+++ [revision details] 2012-01-01 00:00:00 +0000
@@ -0,0 +1,2 @@
+Old revision: tarmac-20130820022554-t4r3stekgq56x0ih
+New revision: <email address hidden>

Index: agent/agent.go
=== modified file 'agent/agent.go'
--- agent/agent.go 2013-08-02 15:50:58 +0000
+++ agent/agent.go 2013-08-20 13:32:26 +0000
@@ -201,7 +201,7 @@
   f := utils.ShQuote(c.confFile())
   addCmd("mkdir -p %s", utils.ShQuote(c.Dir()))
   addCmd("install -m %o /dev/null %s", 0600, f)
- addCmd("echo %s > %s", utils.ShQuote(string(data)), f)
+ addCmd(`printf "%%s\n" %s > %s`, utils.ShQuote(string(data)), f)
   return cmds, nil
  }

Index: cloudinit/cloudinit_test.go
=== modified file 'cloudinit/cloudinit_test.go'
--- cloudinit/cloudinit_test.go 2013-08-19 11:17:19 +0000
+++ cloudinit/cloudinit_test.go 2013-08-20 13:32:26 +0000
@@ -242,7 +242,7 @@
   header = "#cloud-config\n"
   addFileExpected = `runcmd:
  - install -m 644 /dev/null '/etc/apt/apt.conf.d/99proxy'
-- echo '"Acquire::http::Proxy "http://10.0.3.1:3142";'
> '/etc/apt/apt.conf.d/99proxy'
+- printf "%s\n" '"Acquire::http::Proxy "http://10.0.3.1:3142";'
> '/etc/apt/apt.conf.d/99proxy'
  `
  )

Index: cloudinit/options.go
=== modified file 'cloudinit/options.go'
--- cloudinit/options.go 2013-08-05 11:01:08 +0000
+++ cloudinit/options.go 2013-08-20 13:32:26 +0000
@@ -235,10 +235,17 @@
  // AddFile will add multiple run_cmd entries to safely set the contents of
a
  // specific file to the requested contents.
  func (cfg *Config) AddFile(filename, data string, mode uint) {
+ // Note: recent versions of cloud-init have the "write_files"
+ // module, which can write arbitrary files. We currently support
+ // 12.04 LTS, which uses an older version of cloud-init without
+ // this module.
   p := shquote(filename)
+ // Don't use the shell's echo builtin here; the interpretation
+ // of escape sequences differs between shells, namely bash and
+ // dash. Instead, we use printf (or we could use /bin/echo).
   cfg.AddScripts(
    fmt.Sprintf("install -m %o /dev/null %s", mode, p),
- fmt.Sprintf("echo %s > %s", shquote(data), p),
+ fmt.Sprintf(`pr...

Revision history for this message
Roger Peppe (rogpeppe) wrote :

LGTM with two suggestions below.

https://codereview.appspot.com/13123043/diff/1/agent/agent.go
File agent/agent.go (right):

https://codereview.appspot.com/13123043/diff/1/agent/agent.go#newcode204
agent/agent.go:204: addCmd(`printf "%%s\n" %s > %s`,
utils.ShQuote(string(data)), f)
Use single quotes rather than double quotes, perhaps,
as we're not expecting the shell to expand anything
inside them and we're already using single quotes for
everything else?

(applies to the other instances of printf too)

https://codereview.appspot.com/13123043/diff/1/container/lxc/lxc_test.go
File container/lxc/lxc_test.go (right):

https://codereview.appspot.com/13123043/diff/1/container/lxc/lxc_test.go#newcode128
container/lxc/lxc_test.go:128: fmt.Sprintf("printf \"%%s\\n\" '%s' >
'/etc/apt/apt.conf.d/99proxy-extra'", configProxyExtra),
better to use backquotes here now

https://codereview.appspot.com/13123043/

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

On 2013/08/20 13:55:08, rog wrote:
> LGTM with two suggestions below.

Thanks for the review.

> https://codereview.appspot.com/13123043/diff/1/agent/agent.go
> File agent/agent.go (right):

https://codereview.appspot.com/13123043/diff/1/agent/agent.go#newcode204
> agent/agent.go:204: addCmd(`printf "%%s\n" %s > %s`,
> utils.ShQuote(string(data)), f)
> Use single quotes rather than double quotes, perhaps,
> as we're not expecting the shell to expand anything
> inside them and we're already using single quotes for
> everything else?

> (applies to the other instances of printf too)

Done.

https://codereview.appspot.com/13123043/diff/1/container/lxc/lxc_test.go
> File container/lxc/lxc_test.go (right):

https://codereview.appspot.com/13123043/diff/1/container/lxc/lxc_test.go#newcode128
> container/lxc/lxc_test.go:128: fmt.Sprintf("printf \"%%s\\n\" '%s' >
> '/etc/apt/apt.conf.d/99proxy-extra'", configProxyExtra),
> better to use backquotes here now

Done.

https://codereview.appspot.com/13123043/

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'agent/agent.go'
2--- agent/agent.go 2013-08-02 15:50:58 +0000
3+++ agent/agent.go 2013-08-20 14:06:23 +0000
4@@ -201,7 +201,7 @@
5 f := utils.ShQuote(c.confFile())
6 addCmd("mkdir -p %s", utils.ShQuote(c.Dir()))
7 addCmd("install -m %o /dev/null %s", 0600, f)
8- addCmd("echo %s > %s", utils.ShQuote(string(data)), f)
9+ addCmd(`printf '%%s\n' %s > %s`, utils.ShQuote(string(data)), f)
10 return cmds, nil
11 }
12
13
14=== modified file 'cloudinit/cloudinit_test.go'
15--- cloudinit/cloudinit_test.go 2013-08-19 11:17:19 +0000
16+++ cloudinit/cloudinit_test.go 2013-08-20 14:06:23 +0000
17@@ -242,7 +242,7 @@
18 header = "#cloud-config\n"
19 addFileExpected = `runcmd:
20 - install -m 644 /dev/null '/etc/apt/apt.conf.d/99proxy'
21-- echo '"Acquire::http::Proxy "http://10.0.3.1:3142";' > '/etc/apt/apt.conf.d/99proxy'
22+- printf '%s\n' '"Acquire::http::Proxy "http://10.0.3.1:3142";' > '/etc/apt/apt.conf.d/99proxy'
23 `
24 )
25
26
27=== modified file 'cloudinit/options.go'
28--- cloudinit/options.go 2013-08-05 11:01:08 +0000
29+++ cloudinit/options.go 2013-08-20 14:06:23 +0000
30@@ -235,10 +235,17 @@
31 // AddFile will add multiple run_cmd entries to safely set the contents of a
32 // specific file to the requested contents.
33 func (cfg *Config) AddFile(filename, data string, mode uint) {
34+ // Note: recent versions of cloud-init have the "write_files"
35+ // module, which can write arbitrary files. We currently support
36+ // 12.04 LTS, which uses an older version of cloud-init without
37+ // this module.
38 p := shquote(filename)
39+ // Don't use the shell's echo builtin here; the interpretation
40+ // of escape sequences differs between shells, namely bash and
41+ // dash. Instead, we use printf (or we could use /bin/echo).
42 cfg.AddScripts(
43 fmt.Sprintf("install -m %o /dev/null %s", mode, p),
44- fmt.Sprintf("echo %s > %s", shquote(data), p),
45+ fmt.Sprintf(`printf '%%s\n' %s > %s`, shquote(data), p),
46 )
47 }
48
49
50=== modified file 'container/lxc/lxc_test.go'
51--- container/lxc/lxc_test.go 2013-08-09 02:39:51 +0000
52+++ container/lxc/lxc_test.go 2013-08-20 14:06:23 +0000
53@@ -125,7 +125,7 @@
54 c.Assert(scripts[len(scripts)-4:], gc.DeepEquals, []string{
55 "start jujud-machine-1-lxc-0",
56 "install -m 644 /dev/null '/etc/apt/apt.conf.d/99proxy-extra'",
57- fmt.Sprintf("echo '%s' > '/etc/apt/apt.conf.d/99proxy-extra'", configProxyExtra),
58+ fmt.Sprintf(`printf '%%s\n' '%s' > '/etc/apt/apt.conf.d/99proxy-extra'`, configProxyExtra),
59 "ifconfig",
60 })
61
62
63=== modified file 'environs/cloudinit/cloudinit_test.go'
64--- environs/cloudinit/cloudinit_test.go 2013-08-20 02:14:22 +0000
65+++ environs/cloudinit/cloudinit_test.go 2013-08-20 14:06:23 +0000
66@@ -92,13 +92,13 @@
67 wget --no-verbose -O - 'http://foo\.com/tools/juju1\.2\.3-precise-amd64\.tgz' \| tar xz -C \$bin
68 echo -n 'http://foo\.com/tools/juju1\.2\.3-precise-amd64\.tgz' > \$bin/downloaded-url\.txt
69 install -m 600 /dev/null '/etc/rsyslog\.d/25-juju\.conf'
70-echo '\\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'
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 600 /dev/null '/var/lib/juju/agents/machine-0/agent\.conf'
75-echo 'datadir: /var/lib/juju\\nstateservercert:\\n[^']+stateserverkey:\\n[^']+stateport: 37017\\napiport: 17070\\noldpassword: arble\\nmachinenonce: FAKE_NONCE\\nstateinfo:\\n addrs:\\n - localhost:37017\\n cacert:\\n[^']+ tag: machine-0\\n password: ""\\noldapipassword: ""\\napiinfo:\\n addrs:\\n - localhost:17070\\n cacert:\\n[^']+ tag: machine-0\\n password: ""\\n' > '/var/lib/juju/agents/machine-0/agent\.conf'
76+printf '%s\\n' 'datadir: /var/lib/juju\\nstateservercert:\\n[^']+stateserverkey:\\n[^']+stateport: 37017\\napiport: 17070\\noldpassword: arble\\nmachinenonce: FAKE_NONCE\\nstateinfo:\\n addrs:\\n - localhost:37017\\n cacert:\\n[^']+ tag: machine-0\\n password: ""\\noldapipassword: ""\\napiinfo:\\n addrs:\\n - localhost:17070\\n cacert:\\n[^']+ tag: machine-0\\n password: ""\\n' > '/var/lib/juju/agents/machine-0/agent\.conf'
77 install -m 600 /dev/null '/var/lib/juju/server\.pem'
78-echo 'SERVER CERT\\n[^']*SERVER KEY\\n[^']*' > '/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 dd bs=1M count=1 if=/dev/zero of=/var/lib/juju/db/journal/prealloc\.0
82 dd bs=1M count=1 if=/dev/zero of=/var/lib/juju/db/journal/prealloc\.1
83@@ -107,7 +107,7 @@
84 start juju-db
85 mkdir -p '/var/lib/juju/agents/bootstrap'
86 install -m 600 /dev/null '/var/lib/juju/agents/bootstrap/agent\.conf'
87-echo 'datadir: /var/lib/juju\\nstateservercert:\\n[^']+stateserverkey:\\n[^']+stateport: 37017\\napiport: 17070\\noldpassword: arble\\nmachinenonce: FAKE_NONCE\\nstateinfo:\\n addrs:\\n - localhost:37017\\n cacert:\\n[^']+ tag: bootstrap\\n password: ""\\noldapipassword: ""\\napiinfo:\\n addrs:\\n - localhost:17070\\n cacert:\\n[^']+ tag: bootstrap\\n password: ""\\n' > '/var/lib/juju/agents/bootstrap/agent\.conf'
88+printf '%s\\n' 'datadir: /var/lib/juju\\nstateservercert:\\n[^']+stateserverkey:\\n[^']+stateport: 37017\\napiport: 17070\\noldpassword: arble\\nmachinenonce: FAKE_NONCE\\nstateinfo:\\n addrs:\\n - localhost:37017\\n cacert:\\n[^']+ tag: bootstrap\\n password: ""\\noldapipassword: ""\\napiinfo:\\n addrs:\\n - localhost:17070\\n cacert:\\n[^']+ tag: bootstrap\\n password: ""\\n' > '/var/lib/juju/agents/bootstrap/agent\.conf'
89 echo 'some-url' > /tmp/provider-state-url
90 /var/lib/juju/tools/1\.2\.3-precise-amd64/jujud bootstrap-state --data-dir '/var/lib/juju' --env-config '[^']*' --constraints 'mem=2048M' --debug
91 rm -rf '/var/lib/juju/agents/bootstrap'
92@@ -151,13 +151,13 @@
93 wget --no-verbose -O - 'http://foo\.com/tools/juju1\.2\.3-raring-amd64\.tgz' \| tar xz -C \$bin
94 echo -n 'http://foo\.com/tools/juju1\.2\.3-raring-amd64\.tgz' > \$bin/downloaded-url\.txt
95 install -m 600 /dev/null '/etc/rsyslog\.d/25-juju\.conf'
96-echo '\\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'
97+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'
98 restart rsyslog
99 mkdir -p '/var/lib/juju/agents/machine-0'
100 install -m 600 /dev/null '/var/lib/juju/agents/machine-0/agent\.conf'
101-echo 'datadir: /var/lib/juju\\nstateservercert:\\n[^']+stateserverkey:\\n[^']+stateport: 37017\\napiport: 17070\\noldpassword: arble\\nmachinenonce: FAKE_NONCE\\nstateinfo:\\n addrs:\\n - localhost:37017\\n cacert:\\n[^']+ tag: machine-0\\n password: ""\\noldapipassword: ""\\napiinfo:\\n addrs:\\n - localhost:17070\\n cacert:\\n[^']+ tag: machine-0\\n password: ""\\n' > '/var/lib/juju/agents/machine-0/agent\.conf'
102+printf '%s\\n' 'datadir: /var/lib/juju\\nstateservercert:\\n[^']+stateserverkey:\\n[^']+stateport: 37017\\napiport: 17070\\noldpassword: arble\\nmachinenonce: FAKE_NONCE\\nstateinfo:\\n addrs:\\n - localhost:37017\\n cacert:\\n[^']+ tag: machine-0\\n password: ""\\noldapipassword: ""\\napiinfo:\\n addrs:\\n - localhost:17070\\n cacert:\\n[^']+ tag: machine-0\\n password: ""\\n' > '/var/lib/juju/agents/machine-0/agent\.conf'
103 install -m 600 /dev/null '/var/lib/juju/server\.pem'
104-echo 'SERVER CERT\\n[^']*SERVER KEY\\n[^']*' > '/var/lib/juju/server\.pem'
105+printf '%s\\n' 'SERVER CERT\\n[^']*SERVER KEY\\n[^']*' > '/var/lib/juju/server\.pem'
106 mkdir -p /var/lib/juju/db/journal
107 dd bs=1M count=1 if=/dev/zero of=/var/lib/juju/db/journal/prealloc\.0
108 dd bs=1M count=1 if=/dev/zero of=/var/lib/juju/db/journal/prealloc\.1
109@@ -166,7 +166,7 @@
110 start juju-db
111 mkdir -p '/var/lib/juju/agents/bootstrap'
112 install -m 600 /dev/null '/var/lib/juju/agents/bootstrap/agent\.conf'
113-echo 'datadir: /var/lib/juju\\nstateservercert:\\n[^']+stateserverkey:\\n[^']+stateport: 37017\\napiport: 17070\\noldpassword: arble\\nmachinenonce: FAKE_NONCE\\nstateinfo:\\n addrs:\\n - localhost:37017\\n cacert:\\n[^']+ tag: bootstrap\\n password: ""\\noldapipassword: ""\\napiinfo:\\n addrs:\\n - localhost:17070\\n cacert:\\n[^']+ tag: bootstrap\\n password: ""\\n' > '/var/lib/juju/agents/bootstrap/agent\.conf'
114+printf '%s\\n' 'datadir: /var/lib/juju\\nstateservercert:\\n[^']+stateserverkey:\\n[^']+stateport: 37017\\napiport: 17070\\noldpassword: arble\\nmachinenonce: FAKE_NONCE\\nstateinfo:\\n addrs:\\n - localhost:37017\\n cacert:\\n[^']+ tag: bootstrap\\n password: ""\\noldapipassword: ""\\napiinfo:\\n addrs:\\n - localhost:17070\\n cacert:\\n[^']+ tag: bootstrap\\n password: ""\\n' > '/var/lib/juju/agents/bootstrap/agent\.conf'
115 echo 'some-url' > /tmp/provider-state-url
116 /var/lib/juju/tools/1\.2\.3-raring-amd64/jujud bootstrap-state --data-dir '/var/lib/juju' --env-config '[^']*' --constraints 'mem=2048M' --debug
117 rm -rf '/var/lib/juju/agents/bootstrap'
118@@ -205,11 +205,11 @@
119 wget --no-verbose -O - 'http://foo\.com/tools/juju1\.2\.3-linux-amd64\.tgz' \| tar xz -C \$bin
120 echo -n 'http://foo\.com/tools/juju1\.2\.3-linux-amd64\.tgz' > \$bin/downloaded-url\.txt
121 install -m 600 /dev/null '/etc/rsyslog\.d/25-juju\.conf'
122-echo '\\n\$ModLoad imfile\\n\\n\$InputFileStateFile /var/spool/rsyslog/juju-machine-99-state\\n\$InputFilePersistStateInterval 50\\n\$InputFilePollInterval 5\\n\$InputFileName /var/log/juju/machine-99.log\\n\$InputFileTag juju-machine-99:\\n\$InputFileStateFile machine-99\\n\$InputRunFileMonitor\\n\\n:syslogtag, startswith, \"juju-\" @state-addr.testing.invalid:514\\n& ~\\n' > '/etc/rsyslog\.d/25-juju\.conf'
123+printf '%s\\n' '\\n\$ModLoad imfile\\n\\n\$InputFileStateFile /var/spool/rsyslog/juju-machine-99-state\\n\$InputFilePersistStateInterval 50\\n\$InputFilePollInterval 5\\n\$InputFileName /var/log/juju/machine-99.log\\n\$InputFileTag juju-machine-99:\\n\$InputFileStateFile machine-99\\n\$InputRunFileMonitor\\n\\n:syslogtag, startswith, \"juju-\" @state-addr.testing.invalid:514\\n& ~\\n' > '/etc/rsyslog\.d/25-juju\.conf'
124 restart rsyslog
125 mkdir -p '/var/lib/juju/agents/machine-99'
126 install -m 600 /dev/null '/var/lib/juju/agents/machine-99/agent\.conf'
127-echo 'datadir: /var/lib/juju\\noldpassword: arble\\nmachinenonce: FAKE_NONCE\\nstateinfo:\\n addrs:\\n - state-addr\.testing\.invalid:12345\\n cacert:\\n[^']+ tag: machine-99\\n password: ""\\noldapipassword: ""\\napiinfo:\\n addrs:\\n - state-addr\.testing\.invalid:54321\\n cacert:\\n[^']+ tag: machine-99\\n password: ""\\n' > '/var/lib/juju/agents/machine-99/agent\.conf'
128+printf '%s\\n' 'datadir: /var/lib/juju\\noldpassword: arble\\nmachinenonce: FAKE_NONCE\\nstateinfo:\\n addrs:\\n - state-addr\.testing\.invalid:12345\\n cacert:\\n[^']+ tag: machine-99\\n password: ""\\noldapipassword: ""\\napiinfo:\\n addrs:\\n - state-addr\.testing\.invalid:54321\\n cacert:\\n[^']+ tag: machine-99\\n password: ""\\n' > '/var/lib/juju/agents/machine-99/agent\.conf'
129 ln -s 1\.2\.3-linux-amd64 '/var/lib/juju/tools/machine-99'
130 cat >> /etc/init/jujud-machine-99\.conf << 'EOF'\\ndescription "juju machine-99 agent"\\nauthor "Juju Team <juju@lists\.ubuntu\.com>"\\nstart on runlevel \[2345\]\\nstop on runlevel \[!2345\]\\nrespawn\\nnormal exit 0\\nenv JUJU_PROVIDER_TYPE="dummy"\\n\\nlimit nofile 20000 20000\\n\\nexec /var/lib/juju/tools/machine-99/jujud machine --log-file '/var/log/juju/machine-99\.log' --data-dir '/var/lib/juju' --machine-id 99 --debug >> /var/log/juju/machine-99\.log 2>&1\\nEOF\\n
131 start jujud-machine-99
132@@ -246,11 +246,11 @@
133 wget --no-verbose -O - 'http://foo\.com/tools/juju1\.2\.3-linux-amd64\.tgz' \| tar xz -C \$bin
134 echo -n 'http://foo\.com/tools/juju1\.2\.3-linux-amd64\.tgz' > \$bin/downloaded-url\.txt
135 install -m 600 /dev/null '/etc/rsyslog\.d/25-juju\.conf'
136-echo '\\n\$ModLoad imfile\\n\\n\$InputFileStateFile /var/spool/rsyslog/juju-machine-2-lxc-1-state\\n\$InputFilePersistStateInterval 50\\n\$InputFilePollInterval 5\\n\$InputFileName /var/log/juju/machine-2-lxc-1.log\\n\$InputFileTag juju-machine-2-lxc-1:\\n\$InputFileStateFile machine-2-lxc-1\\n\$InputRunFileMonitor\\n\\n:syslogtag, startswith, \"juju-\" @state-addr.testing.invalid:514\\n& ~\\n' > '/etc/rsyslog\.d/25-juju\.conf'
137+printf '%s\\n' '\\n\$ModLoad imfile\\n\\n\$InputFileStateFile /var/spool/rsyslog/juju-machine-2-lxc-1-state\\n\$InputFilePersistStateInterval 50\\n\$InputFilePollInterval 5\\n\$InputFileName /var/log/juju/machine-2-lxc-1.log\\n\$InputFileTag juju-machine-2-lxc-1:\\n\$InputFileStateFile machine-2-lxc-1\\n\$InputRunFileMonitor\\n\\n:syslogtag, startswith, \"juju-\" @state-addr.testing.invalid:514\\n& ~\\n' > '/etc/rsyslog\.d/25-juju\.conf'
138 restart rsyslog
139 mkdir -p '/var/lib/juju/agents/machine-2-lxc-1'
140 install -m 600 /dev/null '/var/lib/juju/agents/machine-2-lxc-1/agent\.conf'
141-echo 'datadir: /var/lib/juju\\noldpassword: arble\\nmachinenonce: FAKE_NONCE\\nstateinfo:\\n addrs:\\n - state-addr\.testing\.invalid:12345\\n cacert:\\n[^']+ tag: machine-2-lxc-1\\n password: ""\\noldapipassword: ""\\napiinfo:\\n addrs:\\n - state-addr\.testing\.invalid:54321\\n cacert:\\n[^']+ tag: machine-2-lxc-1\\n password: ""\\n' > '/var/lib/juju/agents/machine-2-lxc-1/agent\.conf'
142+printf '%s\\n' 'datadir: /var/lib/juju\\noldpassword: arble\\nmachinenonce: FAKE_NONCE\\nstateinfo:\\n addrs:\\n - state-addr\.testing\.invalid:12345\\n cacert:\\n[^']+ tag: machine-2-lxc-1\\n password: ""\\noldapipassword: ""\\napiinfo:\\n addrs:\\n - state-addr\.testing\.invalid:54321\\n cacert:\\n[^']+ tag: machine-2-lxc-1\\n password: ""\\n' > '/var/lib/juju/agents/machine-2-lxc-1/agent\.conf'
143 ln -s 1\.2\.3-linux-amd64 '/var/lib/juju/tools/machine-2-lxc-1'
144 cat >> /etc/init/jujud-machine-2-lxc-1\.conf << 'EOF'\\ndescription "juju machine-2-lxc-1 agent"\\nauthor "Juju Team <juju@lists\.ubuntu\.com>"\\nstart on runlevel \[2345\]\\nstop on runlevel \[!2345\]\\nrespawn\\nnormal exit 0\\nenv JUJU_PROVIDER_TYPE="dummy"\\n\\nlimit nofile 20000 20000\\n\\nexec /var/lib/juju/tools/machine-2-lxc-1/jujud machine --log-file '/var/log/juju/machine-2-lxc-1\.log' --data-dir '/var/lib/juju' --machine-id 2/lxc/1 --debug >> /var/log/juju/machine-2-lxc-1\.log 2>&1\\nEOF\\n
145 start jujud-machine-2-lxc-1

Subscribers

People subscribed via source and target branches

to status/vote changes: