Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnishapi
Project
Project
Details
Activity
Releases
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
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
varnishapi
Commits
43826850
Commit
43826850
authored
Dec 09, 2018
by
Geoff Simmons
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add the admin.GetPanic() method.
parent
e67a0f88
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
0 deletions
+24
-0
cli.go
pkg/admin/cli.go
+24
-0
No files found.
pkg/admin/cli.go
View file @
43826850
...
...
@@ -612,3 +612,27 @@ func (adm *Admin) ActiveVCL() (VCLData, error) {
}
return
vcl
,
nil
}
// GetPanic encapsulates the "panic.show" command. error is non-nil
// when the response was neither of OK or Cant (Cant is the status
// when there was no panic to show). In that case, the error is an
// UnexpectedResponse, which wraps the response from Varnish.
//
// When error is nil, the most recent panic string is returned, or the
// empty string if there has been no panic since Varnish started or
// since the panic was cleared.
func
(
adm
*
Admin
)
GetPanic
()
(
string
,
error
)
{
resp
,
err
:=
adm
.
Command
(
"panic.show"
)
if
err
!=
nil
{
return
""
,
err
}
if
resp
.
Code
==
Cant
{
// Don't panic!
return
""
,
nil
}
if
resp
.
Code
!=
OK
{
badResp
:=
UnexpectedResponse
{
Response
:
resp
}
return
""
,
badResp
}
return
resp
.
Msg
,
nil
}
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