@@ -144,10 +144,18 @@ def sign_query_parameters_from_ttl(self,
144144class RexRequest :
145145 """Wrapper for http calls to include our signature"""
146146
147- def __init__ (self , access_key , secret_key , default_ttl : int = 10 ):
147+ def __init__ (self ,
148+ access_key ,
149+ secret_key ,
150+ default_ttl : int = 10 ,
151+ hash_registry : bool = False ):
148152 self .default_ttl = default_ttl
149153 self .access_key = access_key
150154 self .secret_key = secret_key
155+ # TODO: Hack Alert: Including this for compatability
156+ # Once completed, all refs to the registry hack should be removed
157+ self .hash_registry = hash_registry
158+ # END TODO: Hack Alert
151159 self .signer = Signer (access_key , secret_key )
152160 self .session = make_session ()
153161
@@ -161,12 +169,15 @@ def _signature(self, ttl: int = None, signing_string: str = None) -> str:
161169 signing_string = signing_string
162170 )
163171
164- def _create_auth_headers (self , url , additional_headers = {}, body = '' ):
172+ def _create_auth_headers (self ,
173+ url ,
174+ additional_headers = {},
175+ body = '' ):
165176 signing_string = self .signer ._create_request_body_signing_string (body )
166177
167178 # TODO: Hack alert: Registry doesn't like the sha256 body signing
168179 # string yet
169- if 'https://registry' in url :
180+ if self . hash_registry is False and 'https://registry' in url :
170181 signing_string = ''
171182 # END Hack alert
172183
@@ -188,7 +199,9 @@ def dispatch(self,
188199 additional_headers = {'Content-type' : 'application/json' }
189200 data = json .dumps (data )
190201
191- headers = self ._create_auth_headers (url , additional_headers , body = data )
202+ headers = self ._create_auth_headers (url ,
203+ additional_headers ,
204+ body = data )
192205
193206 if not hasattr (self .session , method .lower ()):
194207 raise AttributeError ('Invalid http method provided.' )
0 commit comments