pyinfra 3.0.dev0__py2.py3-none-any.whl → 3.0.2__py2.py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- pyinfra/api/__init__.py +3 -0
- pyinfra/api/arguments.py +115 -97
- pyinfra/api/arguments_typed.py +80 -0
- pyinfra/api/command.py +5 -3
- pyinfra/api/config.py +139 -39
- pyinfra/api/connectors.py +5 -2
- pyinfra/api/deploy.py +19 -19
- pyinfra/api/exceptions.py +35 -4
- pyinfra/api/facts.py +62 -86
- pyinfra/api/host.py +102 -15
- pyinfra/api/inventory.py +4 -0
- pyinfra/api/operation.py +188 -120
- pyinfra/api/operations.py +66 -113
- pyinfra/api/state.py +53 -34
- pyinfra/api/util.py +64 -33
- pyinfra/connectors/base.py +65 -20
- pyinfra/connectors/chroot.py +15 -13
- pyinfra/connectors/docker.py +62 -72
- pyinfra/connectors/dockerssh.py +20 -19
- pyinfra/connectors/local.py +32 -22
- pyinfra/connectors/ssh.py +162 -86
- pyinfra/connectors/sshuserclient/client.py +1 -1
- pyinfra/connectors/terraform.py +57 -39
- pyinfra/connectors/util.py +26 -27
- pyinfra/connectors/vagrant.py +27 -26
- pyinfra/context.py +1 -0
- pyinfra/facts/apk.py +7 -2
- pyinfra/facts/apt.py +15 -7
- pyinfra/facts/brew.py +28 -13
- pyinfra/facts/bsdinit.py +9 -6
- pyinfra/facts/cargo.py +6 -3
- pyinfra/facts/choco.py +8 -4
- pyinfra/facts/deb.py +21 -9
- pyinfra/facts/dnf.py +11 -6
- pyinfra/facts/docker.py +30 -5
- pyinfra/facts/files.py +49 -33
- pyinfra/facts/gem.py +7 -2
- pyinfra/facts/git.py +14 -21
- pyinfra/facts/gpg.py +4 -1
- pyinfra/facts/hardware.py +186 -138
- pyinfra/facts/launchd.py +7 -2
- pyinfra/facts/lxd.py +8 -2
- pyinfra/facts/mysql.py +19 -12
- pyinfra/facts/npm.py +3 -1
- pyinfra/facts/openrc.py +8 -2
- pyinfra/facts/pacman.py +13 -5
- pyinfra/facts/pip.py +2 -0
- pyinfra/facts/pkg.py +5 -1
- pyinfra/facts/pkgin.py +7 -2
- pyinfra/facts/postgres.py +170 -0
- pyinfra/facts/postgresql.py +5 -162
- pyinfra/facts/rpm.py +21 -15
- pyinfra/facts/runit.py +70 -0
- pyinfra/facts/selinux.py +12 -4
- pyinfra/facts/server.py +240 -82
- pyinfra/facts/snap.py +8 -2
- pyinfra/facts/systemd.py +37 -13
- pyinfra/facts/sysvinit.py +7 -4
- pyinfra/facts/upstart.py +7 -2
- pyinfra/facts/util/packaging.py +3 -2
- pyinfra/facts/vzctl.py +8 -4
- pyinfra/facts/xbps.py +7 -2
- pyinfra/facts/yum.py +10 -5
- pyinfra/facts/zypper.py +9 -4
- pyinfra/operations/apk.py +5 -3
- pyinfra/operations/apt.py +28 -25
- pyinfra/operations/brew.py +60 -29
- pyinfra/operations/bsdinit.py +6 -4
- pyinfra/operations/cargo.py +3 -1
- pyinfra/operations/choco.py +3 -1
- pyinfra/operations/dnf.py +16 -20
- pyinfra/operations/docker.py +339 -0
- pyinfra/operations/files.py +187 -168
- pyinfra/operations/gem.py +3 -1
- pyinfra/operations/git.py +23 -25
- pyinfra/operations/iptables.py +33 -25
- pyinfra/operations/launchd.py +5 -6
- pyinfra/operations/lxd.py +7 -4
- pyinfra/operations/mysql.py +59 -55
- pyinfra/operations/npm.py +8 -1
- pyinfra/operations/openrc.py +5 -3
- pyinfra/operations/pacman.py +6 -7
- pyinfra/operations/pip.py +19 -12
- pyinfra/operations/pkg.py +3 -1
- pyinfra/operations/pkgin.py +5 -3
- pyinfra/operations/postgres.py +349 -0
- pyinfra/operations/postgresql.py +18 -335
- pyinfra/operations/puppet.py +3 -1
- pyinfra/operations/python.py +8 -19
- pyinfra/operations/runit.py +182 -0
- pyinfra/operations/selinux.py +47 -29
- pyinfra/operations/server.py +138 -67
- pyinfra/operations/snap.py +3 -1
- pyinfra/operations/ssh.py +18 -16
- pyinfra/operations/systemd.py +18 -12
- pyinfra/operations/sysvinit.py +7 -5
- pyinfra/operations/upstart.py +7 -5
- pyinfra/operations/util/__init__.py +12 -0
- pyinfra/operations/util/docker.py +177 -0
- pyinfra/operations/util/files.py +24 -16
- pyinfra/operations/util/packaging.py +54 -38
- pyinfra/operations/util/service.py +39 -47
- pyinfra/operations/vzctl.py +12 -10
- pyinfra/operations/xbps.py +5 -3
- pyinfra/operations/yum.py +15 -19
- pyinfra/operations/zypper.py +9 -10
- pyinfra/version.py +5 -2
- {pyinfra-3.0.dev0.dist-info → pyinfra-3.0.2.dist-info}/METADATA +51 -58
- pyinfra-3.0.2.dist-info/RECORD +168 -0
- {pyinfra-3.0.dev0.dist-info → pyinfra-3.0.2.dist-info}/WHEEL +1 -1
- {pyinfra-3.0.dev0.dist-info → pyinfra-3.0.2.dist-info}/entry_points.txt +0 -3
- pyinfra_cli/__main__.py +4 -3
- pyinfra_cli/commands.py +3 -2
- pyinfra_cli/exceptions.py +75 -43
- pyinfra_cli/inventory.py +52 -31
- pyinfra_cli/log.py +10 -2
- pyinfra_cli/main.py +88 -65
- pyinfra_cli/prints.py +37 -109
- pyinfra_cli/util.py +15 -10
- tests/test_api/test_api.py +2 -0
- tests/test_api/test_api_arguments.py +9 -9
- tests/test_api/test_api_deploys.py +15 -19
- tests/test_api/test_api_facts.py +4 -5
- tests/test_api/test_api_operations.py +18 -20
- tests/test_api/test_api_util.py +41 -2
- tests/test_cli/test_cli.py +14 -50
- tests/test_cli/test_cli_deploy.py +17 -14
- tests/test_cli/test_cli_exceptions.py +50 -19
- tests/test_cli/test_cli_inventory.py +66 -0
- tests/test_cli/util.py +1 -1
- tests/test_connectors/test_dockerssh.py +11 -8
- tests/test_connectors/test_ssh.py +88 -23
- tests/test_connectors/test_sshuserclient.py +1 -1
- tests/test_connectors/test_terraform.py +11 -8
- tests/test_connectors/test_vagrant.py +6 -6
- pyinfra/connectors/ansible.py +0 -175
- pyinfra/connectors/mech.py +0 -189
- pyinfra/connectors/pyinfrawinrmsession/__init__.py +0 -28
- pyinfra/connectors/winrm.py +0 -312
- pyinfra/facts/windows.py +0 -366
- pyinfra/facts/windows_files.py +0 -90
- pyinfra/operations/windows.py +0 -59
- pyinfra/operations/windows_files.py +0 -538
- pyinfra-3.0.dev0.dist-info/RECORD +0 -170
- tests/test_connectors/test_ansible.py +0 -64
- tests/test_connectors/test_mech.py +0 -126
- {pyinfra-3.0.dev0.dist-info → pyinfra-3.0.2.dist-info}/LICENSE.md +0 -0
- {pyinfra-3.0.dev0.dist-info → pyinfra-3.0.2.dist-info}/top_level.txt +0 -0
pyinfra/operations/pkgin.py
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Manage pkgin packages.
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
|
|
5
7
|
from pyinfra import host
|
|
6
8
|
from pyinfra.api import operation
|
|
7
9
|
from pyinfra.facts.pkgin import PkginPackages
|
|
@@ -18,7 +20,7 @@ def upgrade():
|
|
|
18
20
|
yield "pkgin -y upgrade"
|
|
19
21
|
|
|
20
22
|
|
|
21
|
-
_upgrade = upgrade # noqa: E305
|
|
23
|
+
_upgrade = upgrade._inner # noqa: E305
|
|
22
24
|
|
|
23
25
|
|
|
24
26
|
@operation(is_idempotent=False)
|
|
@@ -30,12 +32,12 @@ def update():
|
|
|
30
32
|
yield "pkgin -y update"
|
|
31
33
|
|
|
32
34
|
|
|
33
|
-
_update = update # noqa: E305
|
|
35
|
+
_update = update._inner # noqa: E305
|
|
34
36
|
|
|
35
37
|
|
|
36
38
|
@operation()
|
|
37
39
|
def packages(
|
|
38
|
-
packages=None,
|
|
40
|
+
packages: str | list[str] | None = None,
|
|
39
41
|
present=True,
|
|
40
42
|
latest=False,
|
|
41
43
|
update=False,
|
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
"""
|
|
2
|
+
The PostgreSQL modules manage PostgreSQL databases, users and privileges.
|
|
3
|
+
|
|
4
|
+
Requires the ``psql`` CLI executable on the target host(s).
|
|
5
|
+
|
|
6
|
+
All operations in this module take four optional arguments:
|
|
7
|
+
+ ``psql_user``: the username to connect to postgresql to
|
|
8
|
+
+ ``psql_password``: the password for the connecting user
|
|
9
|
+
+ ``psql_host``: the hostname of the server to connect to
|
|
10
|
+
+ ``psql_port``: the port of the server to connect to
|
|
11
|
+
|
|
12
|
+
See example/postgresql.py for detailed example
|
|
13
|
+
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
|
|
18
|
+
from pyinfra import host
|
|
19
|
+
from pyinfra.api import MaskString, StringCommand, operation
|
|
20
|
+
from pyinfra.facts.postgres import (
|
|
21
|
+
PostgresDatabases,
|
|
22
|
+
PostgresRoles,
|
|
23
|
+
make_execute_psql_command,
|
|
24
|
+
make_psql_command,
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
@operation(is_idempotent=False)
|
|
29
|
+
def sql(
|
|
30
|
+
sql: str,
|
|
31
|
+
database: str | None = None,
|
|
32
|
+
# Details for speaking to PostgreSQL via `psql` CLI
|
|
33
|
+
psql_user: str | None = None,
|
|
34
|
+
psql_password: str | None = None,
|
|
35
|
+
psql_host: str | None = None,
|
|
36
|
+
psql_port: int | None = None,
|
|
37
|
+
):
|
|
38
|
+
"""
|
|
39
|
+
Execute arbitrary SQL against PostgreSQL.
|
|
40
|
+
|
|
41
|
+
+ sql: SQL command(s) to execute
|
|
42
|
+
+ database: optional database to execute against
|
|
43
|
+
+ psql_*: global module arguments, see above
|
|
44
|
+
"""
|
|
45
|
+
|
|
46
|
+
yield make_execute_psql_command(
|
|
47
|
+
sql,
|
|
48
|
+
database=database,
|
|
49
|
+
user=psql_user,
|
|
50
|
+
password=psql_password,
|
|
51
|
+
host=psql_host,
|
|
52
|
+
port=psql_port,
|
|
53
|
+
)
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
@operation()
|
|
57
|
+
def role(
|
|
58
|
+
role: str,
|
|
59
|
+
present=True,
|
|
60
|
+
password: str | None = None,
|
|
61
|
+
login=True,
|
|
62
|
+
superuser=False,
|
|
63
|
+
inherit=False,
|
|
64
|
+
createdb=False,
|
|
65
|
+
createrole=False,
|
|
66
|
+
replication=False,
|
|
67
|
+
connection_limit: int | None = None,
|
|
68
|
+
# Details for speaking to PostgreSQL via `psql` CLI
|
|
69
|
+
psql_user: str | None = None,
|
|
70
|
+
psql_password: str | None = None,
|
|
71
|
+
psql_host: str | None = None,
|
|
72
|
+
psql_port: int | None = None,
|
|
73
|
+
):
|
|
74
|
+
"""
|
|
75
|
+
Add/remove PostgreSQL roles.
|
|
76
|
+
|
|
77
|
+
+ role: name of the role
|
|
78
|
+
+ present: whether the role should be present or absent
|
|
79
|
+
+ password: the password for the role
|
|
80
|
+
+ login: whether the role can login
|
|
81
|
+
+ superuser: whether role will be a superuser
|
|
82
|
+
+ inherit: whether the role inherits from other roles
|
|
83
|
+
+ createdb: whether the role is allowed to create databases
|
|
84
|
+
+ createrole: whether the role is allowed to create new roles
|
|
85
|
+
+ replication: whether this role is allowed to replicate
|
|
86
|
+
+ connection_limit: the connection limit for the role
|
|
87
|
+
+ psql_*: global module arguments, see above
|
|
88
|
+
|
|
89
|
+
Updates:
|
|
90
|
+
pyinfra will not attempt to change existing roles - it will either
|
|
91
|
+
create or drop roles, but not alter them (if the role exists this
|
|
92
|
+
operation will make no changes).
|
|
93
|
+
|
|
94
|
+
**Example:**
|
|
95
|
+
|
|
96
|
+
.. code:: python
|
|
97
|
+
|
|
98
|
+
postgresql.role(
|
|
99
|
+
name="Create the pyinfra PostgreSQL role",
|
|
100
|
+
role="pyinfra",
|
|
101
|
+
password="somepassword",
|
|
102
|
+
superuser=True,
|
|
103
|
+
login=True,
|
|
104
|
+
sudo_user="postgres",
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
"""
|
|
108
|
+
|
|
109
|
+
roles = host.get_fact(
|
|
110
|
+
PostgresRoles,
|
|
111
|
+
psql_user=psql_user,
|
|
112
|
+
psql_password=psql_password,
|
|
113
|
+
psql_host=psql_host,
|
|
114
|
+
psql_port=psql_port,
|
|
115
|
+
)
|
|
116
|
+
|
|
117
|
+
is_present = role in roles
|
|
118
|
+
|
|
119
|
+
# User not wanted?
|
|
120
|
+
if not present:
|
|
121
|
+
if is_present:
|
|
122
|
+
yield make_execute_psql_command(
|
|
123
|
+
'DROP ROLE "{0}"'.format(role),
|
|
124
|
+
user=psql_user,
|
|
125
|
+
password=psql_password,
|
|
126
|
+
host=psql_host,
|
|
127
|
+
port=psql_port,
|
|
128
|
+
)
|
|
129
|
+
else:
|
|
130
|
+
host.noop("postgresql role {0} does not exist".format(role))
|
|
131
|
+
return
|
|
132
|
+
|
|
133
|
+
# If we want the user and they don't exist
|
|
134
|
+
if not is_present:
|
|
135
|
+
sql_bits = ['CREATE ROLE "{0}"'.format(role)]
|
|
136
|
+
|
|
137
|
+
for key, value in (
|
|
138
|
+
("LOGIN", login),
|
|
139
|
+
("SUPERUSER", superuser),
|
|
140
|
+
("INHERIT", inherit),
|
|
141
|
+
("CREATEDB", createdb),
|
|
142
|
+
("CREATEROLE", createrole),
|
|
143
|
+
("REPLICATION", replication),
|
|
144
|
+
):
|
|
145
|
+
if value:
|
|
146
|
+
sql_bits.append(key)
|
|
147
|
+
|
|
148
|
+
if connection_limit:
|
|
149
|
+
sql_bits.append("CONNECTION LIMIT {0}".format(connection_limit))
|
|
150
|
+
|
|
151
|
+
if password:
|
|
152
|
+
sql_bits.append(MaskString("PASSWORD '{0}'".format(password)))
|
|
153
|
+
|
|
154
|
+
yield make_execute_psql_command(
|
|
155
|
+
StringCommand(*sql_bits),
|
|
156
|
+
user=psql_user,
|
|
157
|
+
password=psql_password,
|
|
158
|
+
host=psql_host,
|
|
159
|
+
port=psql_port,
|
|
160
|
+
)
|
|
161
|
+
else:
|
|
162
|
+
host.noop("postgresql role {0} exists".format(role))
|
|
163
|
+
|
|
164
|
+
|
|
165
|
+
@operation()
|
|
166
|
+
def database(
|
|
167
|
+
database: str,
|
|
168
|
+
present=True,
|
|
169
|
+
owner: str | None = None,
|
|
170
|
+
template: str | None = None,
|
|
171
|
+
encoding: str | None = None,
|
|
172
|
+
lc_collate: str | None = None,
|
|
173
|
+
lc_ctype: str | None = None,
|
|
174
|
+
tablespace: str | None = None,
|
|
175
|
+
connection_limit: int | None = None,
|
|
176
|
+
# Details for speaking to PostgreSQL via `psql` CLI
|
|
177
|
+
psql_user: str | None = None,
|
|
178
|
+
psql_password: str | None = None,
|
|
179
|
+
psql_host: str | None = None,
|
|
180
|
+
psql_port: int | None = None,
|
|
181
|
+
):
|
|
182
|
+
"""
|
|
183
|
+
Add/remove PostgreSQL databases.
|
|
184
|
+
|
|
185
|
+
+ name: name of the database
|
|
186
|
+
+ present: whether the database should exist or not
|
|
187
|
+
+ owner: the PostgreSQL role that owns the database
|
|
188
|
+
+ template: name of the PostgreSQL template to use
|
|
189
|
+
+ encoding: encoding of the database
|
|
190
|
+
+ lc_collate: lc_collate of the database
|
|
191
|
+
+ lc_ctype: lc_ctype of the database
|
|
192
|
+
+ tablespace: the tablespace to use for the template
|
|
193
|
+
+ connection_limit: the connection limit to apply to the database
|
|
194
|
+
+ psql_*: global module arguments, see above
|
|
195
|
+
|
|
196
|
+
Updates:
|
|
197
|
+
pyinfra will not attempt to change existing databases - it will either
|
|
198
|
+
create or drop databases, but not alter them (if the db exists this
|
|
199
|
+
operation will make no changes).
|
|
200
|
+
|
|
201
|
+
**Example:**
|
|
202
|
+
|
|
203
|
+
.. code:: python
|
|
204
|
+
|
|
205
|
+
postgresql.database(
|
|
206
|
+
name="Create the pyinfra_stuff database",
|
|
207
|
+
database="pyinfra_stuff",
|
|
208
|
+
owner="pyinfra",
|
|
209
|
+
encoding="UTF8",
|
|
210
|
+
sudo_user="postgres",
|
|
211
|
+
)
|
|
212
|
+
|
|
213
|
+
"""
|
|
214
|
+
|
|
215
|
+
current_databases = host.get_fact(
|
|
216
|
+
PostgresDatabases,
|
|
217
|
+
psql_user=psql_user,
|
|
218
|
+
psql_password=psql_password,
|
|
219
|
+
psql_host=psql_host,
|
|
220
|
+
psql_port=psql_port,
|
|
221
|
+
)
|
|
222
|
+
|
|
223
|
+
is_present = database in current_databases
|
|
224
|
+
|
|
225
|
+
if not present:
|
|
226
|
+
if is_present:
|
|
227
|
+
yield make_execute_psql_command(
|
|
228
|
+
'DROP DATABASE "{0}"'.format(database),
|
|
229
|
+
user=psql_user,
|
|
230
|
+
password=psql_password,
|
|
231
|
+
host=psql_host,
|
|
232
|
+
port=psql_port,
|
|
233
|
+
)
|
|
234
|
+
else:
|
|
235
|
+
host.noop("postgresql database {0} does not exist".format(database))
|
|
236
|
+
return
|
|
237
|
+
|
|
238
|
+
# We want the database but it doesn't exist
|
|
239
|
+
if present and not is_present:
|
|
240
|
+
sql_bits = ['CREATE DATABASE "{0}"'.format(database)]
|
|
241
|
+
|
|
242
|
+
for key, value in (
|
|
243
|
+
("OWNER", '"{0}"'.format(owner) if owner else owner),
|
|
244
|
+
("TEMPLATE", template),
|
|
245
|
+
("ENCODING", encoding),
|
|
246
|
+
("LC_COLLATE", lc_collate),
|
|
247
|
+
("LC_CTYPE", lc_ctype),
|
|
248
|
+
("TABLESPACE", tablespace),
|
|
249
|
+
("CONNECTION LIMIT", connection_limit),
|
|
250
|
+
):
|
|
251
|
+
if value:
|
|
252
|
+
sql_bits.append("{0} {1}".format(key, value))
|
|
253
|
+
|
|
254
|
+
yield make_execute_psql_command(
|
|
255
|
+
StringCommand(*sql_bits),
|
|
256
|
+
user=psql_user,
|
|
257
|
+
password=psql_password,
|
|
258
|
+
host=psql_host,
|
|
259
|
+
port=psql_port,
|
|
260
|
+
)
|
|
261
|
+
else:
|
|
262
|
+
host.noop("postgresql database {0} exists".format(database))
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
@operation(is_idempotent=False)
|
|
266
|
+
def dump(
|
|
267
|
+
dest: str,
|
|
268
|
+
database: str | None = None,
|
|
269
|
+
# Details for speaking to PostgreSQL via `psql` CLI
|
|
270
|
+
psql_user: str | None = None,
|
|
271
|
+
psql_password: str | None = None,
|
|
272
|
+
psql_host: str | None = None,
|
|
273
|
+
psql_port: int | None = None,
|
|
274
|
+
):
|
|
275
|
+
"""
|
|
276
|
+
Dump a PostgreSQL database into a ``.sql`` file. Requires ``pg_dump``.
|
|
277
|
+
|
|
278
|
+
+ dest: name of the file to dump the SQL to
|
|
279
|
+
+ database: name of the database to dump
|
|
280
|
+
+ psql_*: global module arguments, see above
|
|
281
|
+
|
|
282
|
+
**Example:**
|
|
283
|
+
|
|
284
|
+
.. code:: python
|
|
285
|
+
|
|
286
|
+
postgresql.dump(
|
|
287
|
+
name="Dump the pyinfra_stuff database",
|
|
288
|
+
dest="/tmp/pyinfra_stuff.dump",
|
|
289
|
+
database="pyinfra_stuff",
|
|
290
|
+
sudo_user="postgres",
|
|
291
|
+
)
|
|
292
|
+
|
|
293
|
+
"""
|
|
294
|
+
|
|
295
|
+
yield StringCommand(
|
|
296
|
+
make_psql_command(
|
|
297
|
+
executable="pg_dump",
|
|
298
|
+
database=database,
|
|
299
|
+
user=psql_user,
|
|
300
|
+
password=psql_password,
|
|
301
|
+
host=psql_host,
|
|
302
|
+
port=psql_port,
|
|
303
|
+
),
|
|
304
|
+
">",
|
|
305
|
+
dest,
|
|
306
|
+
)
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
@operation(is_idempotent=False)
|
|
310
|
+
def load(
|
|
311
|
+
src: str,
|
|
312
|
+
database: str | None = None,
|
|
313
|
+
# Details for speaking to PostgreSQL via `psql` CLI
|
|
314
|
+
psql_user: str | None = None,
|
|
315
|
+
psql_password: str | None = None,
|
|
316
|
+
psql_host: str | None = None,
|
|
317
|
+
psql_port: int | None = None,
|
|
318
|
+
):
|
|
319
|
+
"""
|
|
320
|
+
Load ``.sql`` file into a database.
|
|
321
|
+
|
|
322
|
+
+ src: the filename to read from
|
|
323
|
+
+ database: name of the database to import into
|
|
324
|
+
+ psql_*: global module arguments, see above
|
|
325
|
+
|
|
326
|
+
**Example:**
|
|
327
|
+
|
|
328
|
+
.. code:: python
|
|
329
|
+
|
|
330
|
+
postgresql.load(
|
|
331
|
+
name="Import the pyinfra_stuff dump into pyinfra_stuff_copy",
|
|
332
|
+
src="/tmp/pyinfra_stuff.dump",
|
|
333
|
+
database="pyinfra_stuff_copy",
|
|
334
|
+
sudo_user="postgres",
|
|
335
|
+
)
|
|
336
|
+
|
|
337
|
+
"""
|
|
338
|
+
|
|
339
|
+
yield StringCommand(
|
|
340
|
+
make_psql_command(
|
|
341
|
+
database=database,
|
|
342
|
+
user=psql_user,
|
|
343
|
+
password=psql_password,
|
|
344
|
+
host=psql_host,
|
|
345
|
+
port=psql_port,
|
|
346
|
+
),
|
|
347
|
+
"<",
|
|
348
|
+
src,
|
|
349
|
+
)
|