Merge lp:~axwalk/juju-core/lp1166863-debug-logs-all 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: | 1649 |
Proposed branch: | lp:~axwalk/juju-core/lp1166863-debug-logs-all |
Merge into: | lp:~go-bot/juju-core/trunk |
Diff against target: |
161 lines (+88/-12) 2 files modified
cmd/juju/debuglog.go (+48/-2) cmd/juju/debuglog_test.go (+40/-10) |
To merge this branch: | bzr merge lp:~axwalk/juju-core/lp1166863-debug-logs-all |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Juju Engineering | Pending | ||
Review via email: mp+178028@code.launchpad.net |
Commit message
Description of the change
To post a comment you must log in.
Reviewers: mp+178028_ code.launchpad. net,
Message:
Please take a look.
Description:
debug-log: add -a/--all to get entire log contents
Fixes bug 1166863
https:/ /code.launchpad .net/~axwalk/ juju-core/ lp1166863- debug-logs- all/+merge/ 178028
(do not edit description out of merge proposal)
Please review this at https:/ /codereview. appspot. com/12241043/
Affected files: debuglog. go debuglog_ test.go
A [revision details]
M cmd/juju/
M cmd/juju/
Index: [revision details] 20130801070802- cgvry3o76nnocyq 9
=== 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-
+New revision: <email address hidden>
Index: cmd/juju/ debuglog. go debuglog. go' debuglog. go 2013-05-02 15:55:42 +0000 debuglog. go 2013-08-01 09:25:00 +0000
=== modified file 'cmd/juju/
--- cmd/juju/
+++ cmd/juju/
@@ -10,7 +10,8 @@
type DebugLogCommand struct {
// The debug log command simply invokes juju ssh with the required
arguments.
- sshCmd cmd.Command
+ sshCmd cmd.Command
+ showAll bool
}
const debuglogDoc = `
@@ -29,11 +30,19 @@
func (c *DebugLogCommand) SetFlags(f *gnuflag.FlagSet) { SetFlags( f) &c.showAll, "a", false, "show the complete log file contents") &c.showAll, "all", false, "")
c.sshCmd.
+ f.BoolVar(
+ f.BoolVar(
}
func (c *DebugLogCommand) Init(args []string) error { []string{ "0"}, args...) juju/all- machines. log") []string{ "0"}, args...) // machine 0 juju/all- machines. log"
- args = append(
- args = append(args, "tail -f /var/log/
+ args = append(
+ tailcmd := "tail "
+ if c.showAll {
+ // tail starting from line 1
+ tailcmd += "-n +1 "
+ }
+ tailcmd += "-f /var/log/
+ args = append(args, tailcmd)
return c.sshCmd.Init(args)
}
Index: cmd/juju/ debuglog_ test.go debuglog_ test.go' debuglog_ test.go 2013-05-10 20:55:57 +0000 debuglog_ test.go 2013-08-01 09:25:00 +0000 debugCmd. runCalled, Equals, true) debugCmd. Target, Equals, "0") []string{ "tail -f /var/log/ juju/all- machines. log"}, DeepEquals, sshCmd. (*dummySSHComma nd) debugCmd. runCalled, Equals, true) debugCmd. Target, Equals, "0") []string{ "tail -n +1 -f /var/log/ juju/all- machines. log"},
=== modified file 'cmd/juju/
--- cmd/juju/
+++ cmd/juju/
@@ -42,4 +42,11 @@
c.Assert(
c.Assert(
c.Assert(
debugCmd.Args)
+
+ debugLogCmd, err = runDebugLog(c, "--all")
+ c.Assert(err, IsNil)
+ debugCmd = debugLogCmd.
+ c.Assert(
+ c.Assert(
+ c.Assert(
DeepEquals, debugCmd.Args)
}