Skip to content

cli.db: Use attribute current_version instead of undeclared getter

I have no idea why both exist. But this centralized one (current_version) is declared on most swh modules vs the other method which is not [2]

  • [1]
$SWH_ENVIRONMENT_HOME/swh-indexer/swh/indexer/storage/db.py:    current_version = 133
$SWH_ENVIRONMENT_HOME/swh-scheduler/swh/scheduler/backend.py:    current_version = 33
$SWH_ENVIRONMENT_HOME/swh-scrubber/swh/scrubber/db.py:    current_version = 2
$SWH_ENVIRONMENT_HOME/swh-storage/swh/storage/postgresql/db.py:    current_version = 182
$SWH_ENVIRONMENT_HOME/swh-vault/swh/vault/backend.py:    current_version = 4
  • [2]
grep -r "get_current_version(" $SWH_ENVIRONMENT_HOME/*/swh/
$SWH_ENVIRONMENT_HOME/swh-indexer/swh/indexer/storage/__init__.py:    def get_current_version(self, *, db=None, cur=None):
$SWH_ENVIRONMENT_HOME/swh-scheduler/swh/scheduler/backend.py:    def get_current_version(self):
$SWH_ENVIRONMENT_HOME/swh-storage/swh/storage/postgresql/storage.py:    def get_current_version(self, *, db: Db, cur=None):

Related to T4284 Supersedes !276 (closed)

Test Plan

Patched on scrubber0.staging and now the cli works! [1]

  • [1]
swhworker@scrubber0:~$ swh db --config-file config.yml version scrubber
module: scrubber
current code version: 2
version: 1

Migrated from D7907 (view on Phabricator)

Merge request reports