summaryrefslogtreecommitdiffstats
path: root/openstack/common
diff options
context:
space:
mode:
authorMark McLoughlin <markmc@redhat.com>2013-08-07 07:02:35 +0100
committerMark McLoughlin <markmc@redhat.com>2013-08-07 07:18:53 +0100
commit848c4d530e0c3dd6493289b38366e08260d437ca (patch)
treeccf70b6f4434a87c820e97f5794d9c0ee4f5431e /openstack/common
parent56f0cf134176a380cbc236b1cc8cff63728d5ad0 (diff)
downloadoslo-848c4d530e0c3dd6493289b38366e08260d437ca.tar.gz
oslo-848c4d530e0c3dd6493289b38366e08260d437ca.tar.xz
oslo-848c4d530e0c3dd6493289b38366e08260d437ca.zip
Some nitpicky securemessage cleanups
Remove redundant parenthesis and use a consistent commenting style. Some redundant parenthesis are retained to avoid this pep8 silliness: https://github.com/jcrocholl/pep8/issues/126 i.e. to avoid E125 we have the choice of: if (md['source'] != source or md['destination'] != target or md['expiration'] < time.time()): raise InvalidEncryptedTicket(md['source'], md['destination']) or: if ((md['source'] != source or md['destination'] != target or md['expiration'] < time.time())): raise InvalidEncryptedTicket(md['source'], md['destination']) the latter is my preference. Change-Id: Ic890bfc787a17fc77821e01e586806d1b558d530
Diffstat (limited to 'openstack/common')
-rw-r--r--openstack/common/rpc/securemessage.py12
1 files changed, 6 insertions, 6 deletions
diff --git a/openstack/common/rpc/securemessage.py b/openstack/common/rpc/securemessage.py
index 4ecab02..bcec47e 100644
--- a/openstack/common/rpc/securemessage.py
+++ b/openstack/common/rpc/securemessage.py
@@ -267,7 +267,7 @@ class _KDSClient(object):
def get_ticket(self, source, target, crypto, key):
- #prepare metadata
+ # prepare metadata
md = {'requestor': source,
'target': target,
'timestamp': time.time(),
@@ -281,17 +281,17 @@ class _KDSClient(object):
reply = self._get_ticket({'metadata': metadata,
'signature': signature})
- # Verify reply
+ # verify reply
signature = crypto.sign(key, (reply['metadata'] + reply['ticket']))
if signature != reply['signature']:
raise InvalidEncryptedTicket(md['source'], md['destination'])
md = jsonutils.loads(base64.b64decode(reply['metadata']))
- if (((md['source'] != source) or
- (md['destination'] != target) or
- (md['expiration'] < time.time()))):
+ if ((md['source'] != source or
+ md['destination'] != target or
+ md['expiration'] < time.time())):
raise InvalidEncryptedTicket(md['source'], md['destination'])
- #return ticket data
+ # return ticket data
tkt = jsonutils.loads(crypto.decrypt(key, reply['ticket']))
return tkt, md['expiration']