Skip to content

Commit

Permalink
Fix quoting in postgres dump/load operations
Browse files Browse the repository at this point in the history
  • Loading branch information
Fizzadar committed Aug 10, 2024
1 parent 6314feb commit c7e90ab
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
11 changes: 4 additions & 7 deletions pyinfra/operations/mysql.py
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ def dump(
)
"""

commands_bits = [
yield StringCommand(
make_mysql_command(
executable="mysqldump",
database=database,
Expand All @@ -565,9 +565,7 @@ def dump(
),
">",
QuoteString(dest),
]

yield StringCommand(*commands_bits)
)


@operation(is_idempotent=False)
Expand Down Expand Up @@ -598,7 +596,7 @@ def load(
)
"""

commands_bits = [
yield StringCommand(
make_mysql_command(
database=database,
user=mysql_user,
Expand All @@ -608,5 +606,4 @@ def load(
),
"<",
QuoteString(src),
]
yield StringCommand(*commands_bits)
)
6 changes: 3 additions & 3 deletions pyinfra/operations/postgres.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
from __future__ import annotations

from pyinfra import host
from pyinfra.api import MaskString, StringCommand, operation
from pyinfra.api import MaskString, QuoteString, StringCommand, operation
from pyinfra.facts.postgres import (
PostgresDatabases,
PostgresRoles,
Expand Down Expand Up @@ -302,7 +302,7 @@ def dump(
port=psql_port,
),
">",
dest,
QuoteString(dest),
)


Expand Down Expand Up @@ -345,5 +345,5 @@ def load(
port=psql_port,
),
"<",
src,
QuoteString(src),
)

0 comments on commit c7e90ab

Please sign in to comment.