Loading CHANGES.md +2 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,8 @@ This section will document changes to the library since the last release - ErasePin and LockPin can be set during the security operation - Client fields config and limits show device information - Added unsolicited status support - Pin based operations MUST have a pin set and SSL enabled - setSecurity MUST have SSL enabled ## Behavior changes - Removed GreenClient (Feature overlap with AsyncClient) Loading kinetic/admin/adminclient.py +38 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,35 @@ import logging from kinetic import baseclient from kinetic import operations from kinetic.common import KineticException from functools import wraps def withPin(f): @wraps(f) def wrapper(self, *args, **kwargs): old = self.pin if 'pin' in kwargs: self.pin = kwargs['pin'] del kwargs['pin'] elif not self.pin: raise KineticException("This operation requires a pin.") try: f(self, *args, **kwargs) finally: self.pin = old return wrapper def requiresSsl(f): @wraps(f) def wrapper(self, *args, **kwargs): if not self.use_ssl: raise KineticException("This operation requires SSL.") f(self, *args, **kwargs) return wrapper class AdminClient(baseclient.BaseClient): Loading Loading @@ -54,18 +83,27 @@ class AdminClient(baseclient.BaseClient): def updateFirmware(self, *args, **kwargs): return self._process(operations.UpdateFirmware, *args, **kwargs) @withPin @requiresSsl def unlock(self, *args, **kwargs): return self._process(operations.UnlockDevice, *args, **kwargs) @withPin @requiresSsl def lock(self, *args, **kwargs): return self._process(operations.LockDevice, *args, **kwargs) @withPin @requiresSsl def erase(self, *args, **kwargs): return self._process(operations.EraseDevice, *args, **kwargs) @withPin @requiresSsl def instantSecureErase(self, *args, **kwargs): return self._process(operations.SecureEraseDevice, *args, **kwargs) @requiresSsl def setSecurity(self, *args, **kwargs): """ Set the access control lists to lock users out of different permissions. Loading kinetic/baseclient.py +1 −1 Original line number Diff line number Diff line Loading @@ -111,7 +111,7 @@ class BaseClient(object): # Stage socket on a local variable first s = self.build_socket(family) if self.use_ssl: s = ssl.wrap_socket(s) s = ssl.wrap_socket(s, ssl_version=ssl.PROTOCOL_TLSv1) s.settimeout(self.connect_timeout) if self.socket_address: Loading Loading
CHANGES.md +2 −0 Original line number Diff line number Diff line Loading @@ -15,6 +15,8 @@ This section will document changes to the library since the last release - ErasePin and LockPin can be set during the security operation - Client fields config and limits show device information - Added unsolicited status support - Pin based operations MUST have a pin set and SSL enabled - setSecurity MUST have SSL enabled ## Behavior changes - Removed GreenClient (Feature overlap with AsyncClient) Loading
kinetic/admin/adminclient.py +38 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,35 @@ import logging from kinetic import baseclient from kinetic import operations from kinetic.common import KineticException from functools import wraps def withPin(f): @wraps(f) def wrapper(self, *args, **kwargs): old = self.pin if 'pin' in kwargs: self.pin = kwargs['pin'] del kwargs['pin'] elif not self.pin: raise KineticException("This operation requires a pin.") try: f(self, *args, **kwargs) finally: self.pin = old return wrapper def requiresSsl(f): @wraps(f) def wrapper(self, *args, **kwargs): if not self.use_ssl: raise KineticException("This operation requires SSL.") f(self, *args, **kwargs) return wrapper class AdminClient(baseclient.BaseClient): Loading Loading @@ -54,18 +83,27 @@ class AdminClient(baseclient.BaseClient): def updateFirmware(self, *args, **kwargs): return self._process(operations.UpdateFirmware, *args, **kwargs) @withPin @requiresSsl def unlock(self, *args, **kwargs): return self._process(operations.UnlockDevice, *args, **kwargs) @withPin @requiresSsl def lock(self, *args, **kwargs): return self._process(operations.LockDevice, *args, **kwargs) @withPin @requiresSsl def erase(self, *args, **kwargs): return self._process(operations.EraseDevice, *args, **kwargs) @withPin @requiresSsl def instantSecureErase(self, *args, **kwargs): return self._process(operations.SecureEraseDevice, *args, **kwargs) @requiresSsl def setSecurity(self, *args, **kwargs): """ Set the access control lists to lock users out of different permissions. Loading
kinetic/baseclient.py +1 −1 Original line number Diff line number Diff line Loading @@ -111,7 +111,7 @@ class BaseClient(object): # Stage socket on a local variable first s = self.build_socket(family) if self.use_ssl: s = ssl.wrap_socket(s) s = ssl.wrap_socket(s, ssl_version=ssl.PROTOCOL_TLSv1) s.settimeout(self.connect_timeout) if self.socket_address: Loading