def cache_server(self):
'''Gets the Caching/Tetherator server address, by checking
Caching/Tetherator configurations.'''
# Two places a config file can exist depending on whether this is
# Caching Server in Server.app or a tetherator machine.
config_plists = [self.configuration['tetheratorConfigPlist'],
self.configuration['cacheServerConfigPlist']]
try:
plist = [x for x in config_plists if os.path.exists(x)][0]
self.log.debug('Found caching server plist: %s' % plist)
except:
plist = False
self.log.debug('No caching server plist found.')
if plist:
# Fall back to testing if Caching Server/Server.app or tetherator
try:
port = readPlist(plist)['LastPort']
except:
try:
port = readPlist(plist)['Port']
except:
self.log.debug('No port for caching server found in %s' % plist) # NOQA
raise Exception('No port found.')
if port:
return 'http://localhost:%s' % port
else:
return self.cache_locator()
else:
return self.cache_locator()
评论列表
文章目录