@@ -280,13 +280,7 @@ def push_to_build_cache(self) -> Optional[str]:
280280 a build cache configured without one is read-only - fetched from but never pushed to.
281281 """
282282
283- if (
284- self .buildcache is not None
285- and (
286- self .buildcache .get ("private_key" ) is not None
287- or self .buildcache .get ("access_pair" ) is not None
288- )
289- ):
283+ if self .buildcache is not None and self .buildcache ["private_key" ] is not None :
290284 return self .buildcache ["name" ]
291285 return None
292286
@@ -412,14 +406,14 @@ def config_files(self, config_root: pathlib.Path) -> Dict[pathlib.Path, bytes]:
412406 if self .buildcache ["access_pair" ] and self .buildcache ["endpoint_url" ]:
413407 spack_mirrors ["mirrors" ][self .buildcache ["name" ]] = {
414408 "fetch" : {
415- "url" : mirror [ " url" ] ,
416- "access_pair" : mirror ["access_pair" ],
417- "endpoint_url" : mirror [ "url " ]
409+ "url" : url ,
410+ "access_pair" : self . buildcache ["access_pair" ],
411+ "endpoint_url" : self . buildcache [ "endpoint_url " ]
418412 },
419413 "push" : {
420- "url" : mirror [ " url" ] ,
421- "access_pair" : mirror ["access_pair" ],
422- "endpoint_url" : mirror [ "url " ]
414+ "url" : url ,
415+ "access_pair" : self . buildcache ["access_pair" ],
416+ "endpoint_url" : self . buildcache [ "endpoint_url " ]
423417 },
424418 }
425419 else :
@@ -431,19 +425,22 @@ def config_files(self, config_root: pathlib.Path) -> Dict[pathlib.Path, bytes]:
431425
432426 # source mirrors are read-only and provide sources only. Push url is required but never used
433427 for name , mirror in self .source_mirrors .items ():
434- if mirror ["access_pair" ] and mirror ["endpoint_url" ]:
428+ if (
429+ mirror .get ("access_pair" ) is not None
430+ and mirror .get ("endpoint_url" ) is not None
431+ ):
435432 spack_mirrors ["mirrors" ][name ] = {
436433 "source" : True ,
437434 "binary" : False ,
438435 "fetch" : {
439436 "url" : mirror ["url" ],
440437 "access_pair" : mirror ["access_pair" ],
441- "endpoint_url" : mirror ["url " ]
438+ "endpoint_url" : mirror ["endpoint_url " ]
442439 },
443440 "push" : {
444441 "url" : mirror ["url" ],
445442 "access_pair" : mirror ["access_pair" ],
446- "endpoint_url" : mirror ["url " ]
443+ "endpoint_url" : mirror ["endpoint_url " ]
447444 },
448445 }
449446 else :
0 commit comments