Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Nomad
Commits
13d97f01
Commit
13d97f01
authored
8 years ago
by
vishalnayak
Browse files
Options
Download
Email Patches
Plain Diff
Print debug message only when error is non-nil
parent
68b1b30b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
client/vaultclient/vaultclient.go
+5
-6
client/vaultclient/vaultclient.go
with
5 additions
and
6 deletions
+5
-6
client/vaultclient/vaultclient.go
+
5
-
6
View file @
13d97f01
...
...
@@ -345,7 +345,7 @@ func (c *vaultClient) RenewToken(token string, increment int) <-chan error {
// Perform the renewal of the token and send any error to the dedicated
// error channel.
if
err
:=
c
.
renew
(
renewalReq
);
err
!=
nil
{
c
.
logger
.
Printf
(
"[ERR]
R
enewal of token failed: %v"
,
err
)
c
.
logger
.
Printf
(
"[ERR]
client.vault: r
enewal of token failed: %v"
,
err
)
}
return
errCh
...
...
@@ -384,7 +384,7 @@ func (c *vaultClient) RenewLease(leaseId string, increment int) <-chan error {
// Renew the secret and send any error to the dedicated error channel
if
err
:=
c
.
renew
(
renewalReq
);
err
!=
nil
{
c
.
logger
.
Printf
(
"[ERR]
R
enewal of lease failed: %v"
,
err
)
c
.
logger
.
Printf
(
"[ERR]
client.vault: r
enewal of lease failed: %v"
,
err
)
}
return
errCh
...
...
@@ -460,8 +460,6 @@ func (c *vaultClient) renew(req *vaultClientRenewalRequest) error {
rand
.
Seed
(
time
.
Now
()
.
Unix
())
duration
=
min
+
rand
.
Intn
(
max
-
min
)
}
c
.
logger
.
Printf
(
"[DEBUG] client.vault: req.increment: %d, leaseDuration: %d, duration: %d"
,
req
.
increment
,
leaseDuration
,
duration
)
// Determine the next renewal time
next
:=
time
.
Now
()
.
Add
(
time
.
Duration
(
duration
)
*
time
.
Second
)
...
...
@@ -472,7 +470,8 @@ func (c *vaultClient) renew(req *vaultClientRenewalRequest) error {
strings
.
Contains
(
renewalErr
.
Error
(),
"token not found"
))
{
fatal
=
true
}
else
if
renewalErr
!=
nil
{
c
.
logger
.
Printf
(
"[ERR] renewal of lease or token failed due to a non-fatal error. Retrying at %v"
,
next
.
String
())
c
.
logger
.
Printf
(
"[DEBUG] client.vault: req.increment: %d, leaseDuration: %d, duration: %d"
,
req
.
increment
,
leaseDuration
,
duration
)
c
.
logger
.
Printf
(
"[ERR] client.vault: renewal of lease or token failed due to a non-fatal error. Retrying at %v"
,
next
.
String
())
}
if
c
.
isTracked
(
req
.
id
)
{
...
...
@@ -574,7 +573,7 @@ func (c *vaultClient) run() {
select
{
case
<-
renewalCh
:
if
err
:=
c
.
renew
(
renewalReq
);
err
!=
nil
{
c
.
logger
.
Printf
(
"[ERR]
R
enewal of token failed: %v"
,
err
)
c
.
logger
.
Printf
(
"[ERR]
client.vault: r
enewal of token failed: %v"
,
err
)
}
case
<-
c
.
updateCh
:
continue
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
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
Menu
Projects
Groups
Snippets
Help