From f15974b80dba9da1dee9433c8a44547fd5efd940 Mon Sep 17 00:00:00 2001
From: SandyWalsh <sandy.walsh@rackspace.com>
Date: Wed, 1 Aug 2012 13:23:07 -0500
Subject: [PATCH] Better handling of stale tokens (no more 401's)

There was a problem with stale tokens generating 401's. The
headers for the request where not replacing the stale token
with the freshly obtained one. This patch remedies that.

Change-Id: I8e7c7e01fddeec17ad9ff4254b1223820bb8e2b7
---
 novaclient/client.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/novaclient/client.py b/novaclient/client.py
index 4e6181a49..957df937b 100644
--- a/novaclient/client.py
+++ b/novaclient/client.py
@@ -170,6 +170,7 @@ class HTTPClient(httplib2.Http):
         except exceptions.Unauthorized, ex:
             try:
                 self.authenticate()
+                kwargs['headers']['X-Auth-Token'] = self.auth_token
                 resp, body = self._time_request(self.management_url + url,
                                                 method, **kwargs)
                 return resp, body