def _get_imports_config_revision(): """Returns Revision of last processed imports.cfg config.""" e = importer.config_key().get() if not e or not isinstance(e.config_revision, dict): return None desc = e.config_revision return Revision(desc.get('rev'), desc.get('url'))
def _get_imports_config_revision_async(): """Returns Revision of last processed imports.cfg config.""" e = yield importer.config_key().get_async() if not e or not isinstance(e.config_revision, dict): raise ndb.Return(None) desc = e.config_revision raise ndb.Return(Revision(desc.get('rev'), desc.get('url')))
def put_config(config_proto, config): importer.GroupImporterConfig(key=importer.config_key(), config_proto=config_proto, config=config).put()
def test_write_config(self): put_config('', 'legacy') importer.write_config('tarball{url:"12"\nsystems:"12"}') e = importer.config_key().get() self.assertEqual('legacy', e.config) self.assertEqual('tarball{url:"12"\nsystems:"12"}', e.config_proto)
def put_config(config_proto, config): importer.GroupImporterConfig( key=importer.config_key(), config_proto=config_proto, config=config).put()