2
0
mirror of https://github.com/xcat2/confluent.git synced 2024-11-23 01:53:28 +00:00

Fix bad location of auth check

Auth check was erroneously in a place without
ability to check the authenticated state.  Move
the check up the stack.
This commit is contained in:
Jarrod Johnson 2016-02-21 15:05:11 -05:00
parent 37f1acae1d
commit 18280ccd8a

View File

@ -123,15 +123,23 @@ class Command(object):
def read(self, path, parameters=None):
if not self.authenticated:
raise Exception('Unauthenticated')
return send_request('retrieve', path, self.connection, parameters)
def update(self, path, parameters=None):
if not self.authenticated:
raise Exception('Unauthenticated')
return send_request('update', path, self.connection, parameters)
def create(self, path, parameters=None):
if not self.authenticated:
raise Exception('Unauthenticated')
return send_request('create', path, self.connection, parameters)
def delete(self, path, parameters=None):
if not self.authenticated:
raise Exception('Unauthenticated')
return send_request('delete', path, self.connection, parameters)
def _connect_unix(self):
@ -208,8 +216,6 @@ def send_request(operation, path, server, parameters=None):
:param server: The socket to send data over
:param parameters: Parameters if any to send along with the request
"""
if not self.authenticated:
raise Exception('Unauthenticated')
payload = {'operation': operation, 'path': path}
if parameters is not None:
payload['parameters'] = parameters