Skip to content

Commit

Permalink
fix: revoke-logins skips owner if owner is same as root #509 (#510)
Browse files Browse the repository at this point in the history
  • Loading branch information
vjeeva authored Jul 10, 2024
1 parent b11c12a commit ed7e758
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 6 additions & 1 deletion pgbelt/cmd/login.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,12 @@ async def revoke_logins(config_future: Awaitable[DbupgradeConfig]) -> None:
await _populate_logins(conf.src, pool, logger)
save_task = asyncio.create_task(conf.save())

to_disable = [conf.src.owner_user.name]
to_disable = []
# Sometimes the owner user is the same as the root user.
# When that happens, we don't want to disable the owner user.
# If the owner user is different, we want to disable the owner user.
if conf.src.owner_user.name != conf.src.root_user.name:
to_disable.append(conf.src.owner_user.name)

if conf.src.other_users is not None:
to_disable += [
Expand Down
2 changes: 0 additions & 2 deletions tests/integration/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
import pgbelt
import pytest

from typer import echo


async def _check_status(
configs: dict[str, DbupgradeConfig], src_dst_status: str, dst_src_status: str
Expand Down

0 comments on commit ed7e758

Please sign in to comment.