Changeset View
Changeset View
Standalone View
Standalone View
swh/lister/phabricator/lister.py
Show All 10 Lines | |||||
from swh.lister.phabricator.models import PhabricatorModel | from swh.lister.phabricator.models import PhabricatorModel | ||||
from collections import defaultdict | from collections import defaultdict | ||||
logger = logging.getLogger(__name__) | logger = logging.getLogger(__name__) | ||||
class PhabricatorLister(IndexingHttpLister): | class PhabricatorLister(IndexingHttpLister): | ||||
PATH_TEMPLATE = '?order=oldest&attachments[uris]=1&after=%s' | PATH_TEMPLATE = '?order=oldest&attachments[uris]=1&after=%s' | ||||
DEFAULT_URL = 'https://forge.softwareheritage.org/api/diffusion.repository.search' # noqa | |||||
MODEL = PhabricatorModel | MODEL = PhabricatorModel | ||||
LISTER_NAME = 'phabricator' | LISTER_NAME = 'phabricator' | ||||
def __init__(self, forge_url, instance=None, override_config=None): | def __init__(self, api_baseurl=None, instance=None, override_config=None): | ||||
ardumont: I forgot to mention to check the tasks module.
i think it's broken now as it explicits the… | |||||
Not Done Inline Actions@dourdda sadly, I was right! :) After tagging the new scheduler (and rebuilding docker container) swh-lister_1 | File "/srv/softwareheritage/venv/lib/python3.7/site-packages/swh/lister/cli.py", line 116, in get_lister swh-lister_1 | override_config=override_conf) swh-lister_1 | TypeError: __init__() got an unexpected keyword argument 'forge_url' I'll fix that ;) ardumont: @dourdda sadly, I was right! :)
After tagging the new scheduler (and rebuilding docker… | |||||
if forge_url.endswith("/"): | |||||
forge_url = forge_url[:-1] | |||||
self.forge_url = forge_url | |||||
api_baseurl = '%s/api/diffusion.repository.search' % forge_url | |||||
if not instance: | |||||
instance = urllib.parse.urlparse(forge_url).hostname | |||||
self.instance = instance | |||||
super().__init__(api_baseurl=api_baseurl, | super().__init__(api_baseurl=api_baseurl, | ||||
override_config=override_config) | override_config=override_config) | ||||
if not instance: | |||||
instance = urllib.parse.urlparse(self.api_baseurl).hostname | |||||
self.instance = instance | |||||
@property | @property | ||||
def default_min_bound(self): | def default_min_bound(self): | ||||
"""Starting boundary when `min_bound` is not defined (db empty). This | """Starting boundary when `min_bound` is not defined (db empty). This | ||||
is used within the fn:`run` call. | is used within the fn:`run` call. | ||||
""" | """ | ||||
return self._bootstrap_repositories_listing() | return self._bootstrap_repositories_listing() | ||||
Show All 27 Lines | def request_headers(self): | ||||
return {'User-Agent': 'Software Heritage phabricator lister', | return {'User-Agent': 'Software Heritage phabricator lister', | ||||
'Accept': 'application/json'} | 'Accept': 'application/json'} | ||||
def get_model_from_repo(self, repo): | def get_model_from_repo(self, repo): | ||||
url = get_repo_url(repo['attachments']['uris']['uris']) | url = get_repo_url(repo['attachments']['uris']['uris']) | ||||
if url is None: | if url is None: | ||||
return None | return None | ||||
return { | return { | ||||
'uid': self.forge_url + str(repo['id']), | 'uid': url, | ||||
'indexable': repo['id'], | 'indexable': repo['id'], | ||||
'name': repo['fields']['shortName'], | 'name': repo['fields']['shortName'], | ||||
'full_name': repo['fields']['name'], | 'full_name': repo['fields']['name'], | ||||
'html_url': url, | 'html_url': url, | ||||
'origin_url': url, | 'origin_url': url, | ||||
'origin_type': repo['fields']['vcs'], | 'origin_type': repo['fields']['vcs'], | ||||
'instance': self.instance, | 'instance': self.instance, | ||||
} | } | ||||
▲ Show 20 Lines • Show All 74 Lines • Show Last 20 Lines |
I forgot to mention to check the tasks module.
i think it's broken now as it explicits the forge_url there (in my current local version though at least ;)
I'm not sure where this is coming from (it should but i don't think it is coming from the plugin refactoring yet).