def _reloadConfig(): """should clear as many caches as we can get hold of. """ base.caches.clearCaches() root.loadUserVanity(root.ArchiveService) config.makeFallbackMeta(reload=True) config.loadConfig() base.ui.notifyInfo("Cleared caches on SIGHUP")
def makeDefaultMeta(): destPath = os.path.join(base.getConfig("configDir"), "defaultmeta.txt") if os.path.exists(destPath): return rawData = r"""publisher: Your organisation's name publisherID: ivo://x-unregistred contact.name: Fill Out contact.address: Ordinary street address. contact.email: [email protected] contact.telephone: Delete this line if you don't want to give it creator.name: Could be same as contact.name creator.logo: a URL pointing to a small png _noresultwarning: Your query did not match any data. authority.creationDate: %s authority.title: Untitled data center authority.shortName: DaCHS test authority.description: This should be a relatively terse \ description of what you clam authority for. authority.referenceURL: (your DC's "contact" page, presumably) authority.managingOrg: ivo://x-unregistred/org organization.title: Unconfigured organization organization.description: Briefly describe the organization you're \ running the dc for here. organization.referenceURL: http://your.institution/home site.description: This should be a relatively terse \ description of your data center. You must give sensible values \ for all authority.* things before publishing your registry endpoint. """ % (datetime.datetime.utcnow()) with open(destPath, "w") as f: f.write(unindentString(rawData)) # load new new default meta from gavo.base import config config.makeFallbackMeta()
from gavo import base #noflake: import above is conditional dbname = "dachstest" if not os.path.exists(base.getConfig("rootDir")): from gavo.user import initdachs try: dsn = initdachs.DSN(dbname) subprocess.call(["createdb", "--template=template0", "--encoding=UTF-8", "--locale=C", dbname]) initdachs.createFSHierarchy(dsn, "test") with open(os.path.join( base.getConfig("configDir"), "defaultmeta.txt"), "a") as f: f.write("!organization.description: Mein w\xc3\xbcster Club\n") f.write("!contact.email: [email protected]\n") from gavo.base import config config.makeFallbackMeta(reload=True) os.symlink(os.path.join(TEST_BASE, "test_data"), os.path.join(base.getConfig("inputsDir"), "data")) os.rmdir(os.path.join(base.getConfig("inputsDir"), "__system")) os.symlink(os.path.join(TEST_BASE, "test_data", "__system"), os.path.join(base.getConfig("inputsDir"), "__system")) os.mkdir(os.path.join(base.getConfig("inputsDir"), "test")) initdachs.initDB(dsn) from gavo.registry import publication from gavo import rsc from gavo import rscdesc #noflake: caches registration from gavo import base publication.updateServiceList([base.caches.getRD("//services")])