From c53c96d9ca84038bb97342b1ad273bef8c8e8e1d Mon Sep 17 00:00:00 2001 From: Sam Batschelet Date: Sat, 17 Jun 2017 18:19:54 -0400 Subject: [PATCH] Clear token value when auth is disabled. --- .travis.yml | 2 +- lib/Net/Etcd.pm | 5 ++++- lib/Net/Etcd/Auth.pm | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 6128438..024d652 100644 --- a/.travis.yml +++ b/.travis.yml @@ -41,4 +41,4 @@ install: script: - perl Makefile.PL - make - - prove -b -r -s -j$(test-jobs) $(test-files) + - make test diff --git a/lib/Net/Etcd.pm b/lib/Net/Etcd.pm index b8287f3..77a8579 100644 --- a/lib/Net/Etcd.pm +++ b/lib/Net/Etcd.pm @@ -171,7 +171,10 @@ authentication process and stored until no longer valid or username is changed. =cut -has auth_token => ( is => 'rwp' ); +has auth_token => ( + is => 'rwp', + clearer => 1, +); =head1 PUBLIC METHODS diff --git a/lib/Net/Etcd/Auth.pm b/lib/Net/Etcd/Auth.pm index 76517af..f7b2f24 100644 --- a/lib/Net/Etcd/Auth.pm +++ b/lib/Net/Etcd/Auth.pm @@ -148,6 +148,7 @@ sub disable { confess 'root name and password required for ' . __PACKAGE__ . '->disable' unless ($self->password && $self->name); $self->request; + $self->etcd->clear_auth_token; return $self; }