Merge lp:~adam-collard/landscape-charm/collect-logs-clean-juju-2 into lp:~landscape/landscape-charm/tools

Proposed by Adam Collard
Status: Merged
Approved by: Adam Collard
Approved revision: 36
Merged at revision: 38
Proposed branch: lp:~adam-collard/landscape-charm/collect-logs-clean-juju-2
Merge into: lp:~landscape/landscape-charm/tools
Diff against target: 71 lines (+10/-11)
2 files modified
collect-logs (+7/-8)
test_collect-logs.py (+3/-3)
To merge this branch: bzr merge lp:~adam-collard/landscape-charm/collect-logs-clean-juju-2
Reviewer Review Type Date Requested Status
David Britton (community) Approve
🤖 Landscape Builder test results Approve
Francis Ginther Pending
Review via email: mp+314012@code.launchpad.net

Commit message

Fix name of Juju 2's model-config in collect-logs

Description of the change

Fix name of Juju 2's model-config in collect-logs

Testing instructions:
* Run collect-logs on a Juju 2.1 model, verify that proxy-ssh is set

To post a comment you must log in.
Revision history for this message
🤖 Landscape Builder (landscape-builder) :
review: Abstain (executing tests)
Revision history for this message
🤖 Landscape Builder (landscape-builder) wrote :
review: Approve (test results)
Revision history for this message
David Britton (dpb) wrote :

Merge conflict exists

36. By Adam Collard

Fix merge conflicts

Revision history for this message
Adam Collard (adam-collard) wrote :

> Merge conflict exists

Thanks, fixed.

Revision history for this message
🤖 Landscape Builder (landscape-builder) :
review: Abstain (executing tests)
Revision history for this message
🤖 Landscape Builder (landscape-builder) wrote :
review: Approve (test results)
Revision history for this message
David Britton (dpb) wrote :

Ran into an issue where ls -rt didn't work:

drwx------ 3 landscape landscape 4096 Jan 4 22:46 1
drwx------ 3 landscape landscape 4096 Jan 5 04:28 2
drwx------ 3 landscape landscape 4096 Jan 5 04:19 3

Suggest we modify the "ls -rt | tail -1" to instead do 'ls | sort -n | tail -1'

This is a bit of an edge condition, but seems like a sane fix.

Approved with above caveats.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'collect-logs'
2--- collect-logs 2017-01-04 02:09:01 +0000
3+++ collect-logs 2017-01-05 17:33:26 +0000
4@@ -131,7 +131,7 @@
5 if self.binary_path == JUJU1:
6 args = self._resolve("set-env", item)
7 else:
8- args = self._resolve("set-model-config", item)
9+ args = self._resolve("model-config", item)
10 return args
11
12 def format_set_model_config(self, key, value):
13@@ -392,7 +392,9 @@
14 try:
15 check_output(args2, stderr=STDOUT, env=juju.env)
16 except CalledProcessError as e:
17- pass
18+ log.warning("Couldn't disable proxy-ssh in the inner environment "
19+ "using Juju 2, attempting Juju 1.")
20+ log.warning("Error was:\n{}".format(e.output))
21 else:
22 return
23
24@@ -404,13 +406,10 @@
25 try:
26 check_output(args1, stderr=STDOUT, env=juju.env)
27 except CalledProcessError as e:
28- pass
29- else:
30- return
31+ log.warning("Couldn't disable proxy-ssh in the inner environment "
32+ "using Juju 1, collecting inner logs might fail.")
33+ log.warning("Error was:\n{}".format(e.output))
34
35- log.warning("Couldn't disable proxy-ssh in the inner environment,"
36- " collecting inner logs might fail.")
37- log.warning("Error was:\n{}".format(e.output))
38
39
40 def find_inner_juju(juju, landscape_unit, inner_model=DEFAULT_MODEL):
41
42=== modified file 'test_collect-logs.py'
43--- test_collect-logs.py 2017-01-04 02:09:01 +0000
44+++ test_collect-logs.py 2017-01-05 17:33:26 +0000
45@@ -547,7 +547,7 @@
46 expected = []
47 cmd = ("sudo JUJU_DATA=/var/lib/landscape/juju-homes/"
48 "`sudo ls -rt /var/lib/landscape/juju-homes/ | tail -1`"
49- " juju-2.1 set-model-config -m controller proxy-ssh=false")
50+ " juju-2.1 model-config -m controller proxy-ssh=false")
51 expected.append(mock.call(["juju", "ssh", "landscape-server/0", cmd],
52 stderr=subprocess.STDOUT,
53 env=self.juju.env))
54@@ -625,7 +625,7 @@
55 expected = []
56 cmd = ("sudo JUJU_DATA=/var/lib/landscape/juju-homes/"
57 "`sudo ls -rt /var/lib/landscape/juju-homes/ | tail -1`"
58- " juju-2.1 set-model-config -m controller proxy-ssh=false")
59+ " juju-2.1 model-config -m controller proxy-ssh=false")
60 expected.append(mock.call(["juju", "ssh", "landscape-server/0", cmd],
61 stderr=subprocess.STDOUT,
62 env=None))
63@@ -698,7 +698,7 @@
64 expected = []
65 cmd = ("sudo JUJU_DATA=/var/lib/landscape/juju-homes/"
66 "`sudo ls -rt /var/lib/landscape/juju-homes/ | tail -1`"
67- " juju-2.1 set-model-config -m controller proxy-ssh=false")
68+ " juju-2.1 model-config -m controller proxy-ssh=false")
69 expected.append(mock.call(["juju", "ssh", "landscape/0", cmd],
70 stderr=subprocess.STDOUT,
71 env=None))

Subscribers

People subscribed via source and target branches

to all changes: