Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
8896293c
Commit
8896293c
authored
Nov 29, 2016
by
deads2k
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add stderr to command errors
parent
e6c57c65
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
1 deletion
+30
-1
e2e.go
hack/e2e.go
+30
-1
No files found.
hack/e2e.go
View file @
8896293c
...
@@ -584,7 +584,7 @@ func clusterSize(deploy deployer) (int, error) {
...
@@ -584,7 +584,7 @@ func clusterSize(deploy deployer) (int, error) {
}
}
o
,
err
:=
exec
.
Command
(
"kubectl"
,
"get"
,
"nodes"
,
"--no-headers"
)
.
Output
()
o
,
err
:=
exec
.
Command
(
"kubectl"
,
"get"
,
"nodes"
,
"--no-headers"
)
.
Output
()
if
err
!=
nil
{
if
err
!=
nil
{
log
.
Printf
(
"kubectl get nodes failed: %
v"
,
err
)
log
.
Printf
(
"kubectl get nodes failed: %
s
\n
%s"
,
WrapError
(
err
)
.
Error
(),
string
(
o
)
)
return
-
1
,
err
return
-
1
,
err
}
}
stdout
:=
strings
.
TrimSpace
(
string
(
o
))
stdout
:=
strings
.
TrimSpace
(
string
(
o
))
...
@@ -592,6 +592,35 @@ func clusterSize(deploy deployer) (int, error) {
...
@@ -592,6 +592,35 @@ func clusterSize(deploy deployer) (int, error) {
return
len
(
strings
.
Split
(
stdout
,
"
\n
"
)),
nil
return
len
(
strings
.
Split
(
stdout
,
"
\n
"
)),
nil
}
}
// CommandError will provide stderr output (if available) from structured
// exit errors
type
CommandError
struct
{
err
error
}
func
WrapError
(
err
error
)
*
CommandError
{
if
err
==
nil
{
return
nil
}
return
&
CommandError
{
err
:
err
}
}
func
(
e
*
CommandError
)
Error
()
string
{
if
e
==
nil
{
return
""
}
exitErr
,
ok
:=
e
.
err
.
(
*
exec
.
ExitError
)
if
!
ok
{
return
e
.
err
.
Error
()
}
stderr
:=
""
if
exitErr
.
Stderr
!=
nil
{
stderr
=
string
(
stderr
)
}
return
fmt
.
Sprintf
(
"%q: %q"
,
exitErr
.
Error
(),
stderr
)
}
func
DumpClusterLogs
(
location
string
)
error
{
func
DumpClusterLogs
(
location
string
)
error
{
log
.
Printf
(
"Dumping cluster logs to: %v"
,
location
)
log
.
Printf
(
"Dumping cluster logs to: %v"
,
location
)
return
finishRunning
(
"dump cluster logs"
,
exec
.
Command
(
"./cluster/log-dump.sh"
,
location
))
return
finishRunning
(
"dump cluster logs"
,
exec
.
Command
(
"./cluster/log-dump.sh"
,
location
))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment