Page MenuHomeSoftware Heritage

Split db-init cli in 2 (init and create) and move them under 'swh db'
ClosedPublic

Authored by douardda on Sep 21 2020, 4:36 PM.

Details

Summary

Also get rid of the previous (unused) 'swh db init' command.

Event Timeline

Build is green

Patch application report for D4000 (id=14105)

Rebasing onto e5312bdaa8...

Current branch diff-target is up to date.
Changes applied before test
commit b7593ab57ab4507b4b05d643ed6e4a68b83e7913
Author: David Douard <david.douard@sdfa3.org>
Date:   Mon Sep 21 16:25:52 2020 +0200

    Split db-init cli in 2 (init and create) and move them under 'swh db'
    
    Also get rid of the previous (unused) 'swh db init' command.

See https://jenkins.softwareheritage.org/job/DCORE/job/tests-on-diff/67/ for more details.

Build is green

Patch application report for D4000 (id=14106)

Rebasing onto e5312bdaa8...

Current branch diff-target is up to date.
Changes applied before test
commit 2a2c8f1bde96e25fba9bf69179dc65a2115ee507
Author: David Douard <david.douard@sdfa3.org>
Date:   Mon Sep 21 16:25:52 2020 +0200

    Split db-init cli in 2 (init and create) and move them under 'swh db'
    
    The idea it to have the 'swh db create' command to create the database
    and prepare it by executing SQL -superuser- files, i.e. SQL files which
    execution requires superuser permissions -- typically install languages
    or extensions.
    
    Then the 'swh db init' execute the initialization SQL files that do not
    require superuser permissions.
    
    Also get rid of the previous (unused) 'swh db init' command.

See https://jenkins.softwareheritage.org/job/DCORE/job/tests-on-diff/68/ for more details.

ardumont added a subscriber: ardumont.

lgtm

one comment/remark inline about a missed docstring update to drop some return value.

swh/core/cli/db.py
182

Looks like this needs to be removed from the docstring.

The last call is execute_sql_files (which seem to no longer return anything, --quiet is passed to psql).
Also this is done by the swh db init command now.

This revision is now accepted and ready to land.Sep 21 2020, 5:08 PM

several fixes and add a --template option to 'swh db create'

Build is green

Patch application report for D4000 (id=14107)

Rebasing onto e5312bdaa8...

Current branch diff-target is up to date.
Changes applied before test
commit 8ca045e0df8e07fb2cc6ad3f521c931001dba57f
Author: David Douard <david.douard@sdfa3.org>
Date:   Mon Sep 21 16:25:52 2020 +0200

    Split db-init cli in 2 (init and create) and move them under 'swh db'
    
    The idea it to have the 'swh db create' command to create the database
    and prepare it by executing SQL -superuser- files, i.e. SQL files which
    execution requires superuser permissions -- typically install languages
    or extensions.
    
    Then the 'swh db init' execute the initialization SQL files that do not
    require superuser permissions.
    
    Also get rid of the previous (unused) 'swh db init' command.

See https://jenkins.softwareheritage.org/job/DCORE/job/tests-on-diff/69/ for more details.

swh/core/cli/db.py
182

I thought I did remove this Returns: field but I did not apparently, thx

fix docstring (thx ardumont)

This revision was landed with ongoing or failed builds.Sep 22 2020, 9:37 AM
This revision was automatically updated to reflect the committed changes.

Build is green

Patch application report for D4000 (id=14108)

Rebasing onto e5312bdaa8...

Current branch diff-target is up to date.
Changes applied before test
commit 56d505f34a96e2ee76457a22c866cb3a204ae77b
Author: David Douard <david.douard@sdfa3.org>
Date:   Mon Sep 21 16:25:52 2020 +0200

    Split db-init cli in 2 (init and create) and move them under 'swh db'
    
    The idea it to have the 'swh db create' command to create the database
    and prepare it by executing SQL -superuser- files, i.e. SQL files which
    execution requires superuser permissions -- typically install languages
    or extensions.
    
    Then the 'swh db init' execute the initialization SQL files that do not
    require superuser permissions.
    
    Also get rid of the previous (unused) 'swh db init' command.

See https://jenkins.softwareheritage.org/job/DCORE/job/tests-on-diff/70/ for more details.