Skip to content

Commit

Permalink
fix: sync should ensure admin user is created (#76683)
Browse files Browse the repository at this point in the history
  • Loading branch information
joshuarli authored and ArthurKnaus committed Aug 29, 2024
1 parent 821148d commit ada9512
Showing 1 changed file with 32 additions and 3 deletions.
35 changes: 32 additions & 3 deletions devenv/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def run_procs(
f"""
{name}
failed command (code p.returncode):
failed command (code {p.returncode}):
{shlex.join(final_cmd)}
Output:
Expand Down Expand Up @@ -235,7 +235,7 @@ def main(context: dict[str, str]) -> int:
exit=True,
)

if run_procs(
if not run_procs(
repo,
reporoot,
venv_dir,
Expand All @@ -247,6 +247,35 @@ def main(context: dict[str, str]) -> int:
),
),
):
return 0
return 1

# faster prerequisite check than starting up sentry and running createuser idempotently
stdout = proc.run(
(
"docker",
"exec",
"sentry_postgres",
"psql",
"sentry",
"postgres",
"-t",
"-c",
"select exists (select from auth_user where email = 'admin@sentry.io')",
),
stdout=True,
)
if stdout != "t":
proc.run(
(
f"{venv_dir}/bin/sentry",
"createuser",
"--superuser",
"--email",
"admin@sentry.io",
"--password",
"admin",
"--no-input",
)
)

return 1

0 comments on commit ada9512

Please sign in to comment.