pyinfra 3.0b1__py2.py3-none-any.whl → 3.0b2__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/arguments.py +9 -3
- pyinfra/api/arguments_typed.py +8 -5
- pyinfra/api/command.py +5 -3
- pyinfra/api/config.py +115 -13
- pyinfra/api/connectors.py +5 -2
- pyinfra/api/facts.py +33 -32
- pyinfra/api/host.py +5 -5
- pyinfra/api/inventory.py +4 -0
- pyinfra/api/operation.py +22 -14
- pyinfra/api/util.py +24 -16
- pyinfra/connectors/base.py +3 -6
- pyinfra/connectors/docker.py +2 -9
- pyinfra/connectors/local.py +2 -2
- pyinfra/connectors/ssh.py +2 -2
- pyinfra/connectors/util.py +6 -7
- pyinfra/connectors/vagrant.py +5 -5
- pyinfra/context.py +1 -0
- pyinfra/facts/apk.py +2 -0
- pyinfra/facts/apt.py +2 -0
- pyinfra/facts/brew.py +2 -0
- pyinfra/facts/bsdinit.py +2 -0
- pyinfra/facts/cargo.py +2 -0
- pyinfra/facts/choco.py +2 -0
- pyinfra/facts/deb.py +7 -2
- pyinfra/facts/dnf.py +2 -0
- pyinfra/facts/docker.py +2 -0
- pyinfra/facts/files.py +2 -0
- pyinfra/facts/gem.py +2 -0
- pyinfra/facts/gpg.py +2 -0
- pyinfra/facts/hardware.py +30 -22
- pyinfra/facts/launchd.py +2 -0
- pyinfra/facts/lxd.py +2 -0
- pyinfra/facts/mysql.py +12 -6
- pyinfra/facts/npm.py +1 -0
- pyinfra/facts/openrc.py +2 -0
- pyinfra/facts/pacman.py +6 -2
- pyinfra/facts/pip.py +2 -0
- pyinfra/facts/pkg.py +2 -0
- pyinfra/facts/pkgin.py +2 -0
- pyinfra/facts/postgres.py +6 -6
- pyinfra/facts/postgresql.py +2 -0
- pyinfra/facts/rpm.py +12 -9
- pyinfra/facts/server.py +10 -13
- pyinfra/facts/snap.py +2 -0
- pyinfra/facts/systemd.py +2 -0
- pyinfra/facts/upstart.py +2 -0
- pyinfra/facts/util/packaging.py +3 -2
- pyinfra/facts/vzctl.py +2 -0
- pyinfra/facts/xbps.py +2 -0
- pyinfra/facts/yum.py +2 -0
- pyinfra/facts/zypper.py +2 -0
- pyinfra/operations/apk.py +3 -1
- pyinfra/operations/apt.py +16 -18
- pyinfra/operations/brew.py +10 -8
- pyinfra/operations/bsdinit.py +5 -3
- pyinfra/operations/cargo.py +3 -1
- pyinfra/operations/choco.py +3 -1
- pyinfra/operations/dnf.py +15 -19
- pyinfra/operations/files.py +81 -66
- pyinfra/operations/gem.py +3 -1
- pyinfra/operations/git.py +18 -16
- pyinfra/operations/iptables.py +27 -25
- pyinfra/operations/launchd.py +5 -6
- pyinfra/operations/lxd.py +7 -4
- pyinfra/operations/mysql.py +57 -53
- pyinfra/operations/npm.py +8 -1
- pyinfra/operations/openrc.py +5 -3
- pyinfra/operations/pacman.py +4 -5
- pyinfra/operations/pip.py +11 -9
- pyinfra/operations/pkg.py +3 -1
- pyinfra/operations/pkgin.py +3 -1
- pyinfra/operations/postgres.py +39 -37
- pyinfra/operations/postgresql.py +2 -0
- pyinfra/operations/puppet.py +3 -1
- pyinfra/operations/python.py +7 -3
- pyinfra/operations/selinux.py +42 -16
- pyinfra/operations/server.py +48 -43
- pyinfra/operations/snap.py +3 -1
- pyinfra/operations/ssh.py +12 -10
- pyinfra/operations/systemd.py +8 -6
- pyinfra/operations/sysvinit.py +6 -4
- pyinfra/operations/upstart.py +5 -3
- pyinfra/operations/util/files.py +24 -16
- pyinfra/operations/util/packaging.py +53 -37
- pyinfra/operations/util/service.py +18 -13
- pyinfra/operations/vzctl.py +12 -10
- pyinfra/operations/xbps.py +3 -1
- pyinfra/operations/yum.py +14 -18
- pyinfra/operations/zypper.py +8 -9
- pyinfra/version.py +5 -2
- {pyinfra-3.0b1.dist-info → pyinfra-3.0b2.dist-info}/METADATA +28 -26
- pyinfra-3.0b2.dist-info/RECORD +163 -0
- {pyinfra-3.0b1.dist-info → pyinfra-3.0b2.dist-info}/WHEEL +1 -1
- pyinfra_cli/exceptions.py +0 -5
- pyinfra_cli/inventory.py +38 -19
- pyinfra_cli/prints.py +15 -11
- pyinfra_cli/util.py +3 -1
- tests/test_api/test_api_operations.py +1 -1
- tests/test_connectors/test_ssh.py +66 -13
- tests/test_connectors/test_vagrant.py +3 -3
- pyinfra-3.0b1.dist-info/RECORD +0 -163
- {pyinfra-3.0b1.dist-info → pyinfra-3.0b2.dist-info}/LICENSE.md +0 -0
- {pyinfra-3.0b1.dist-info → pyinfra-3.0b2.dist-info}/entry_points.txt +0 -0
- {pyinfra-3.0b1.dist-info → pyinfra-3.0b2.dist-info}/top_level.txt +0 -0
pyinfra/operations/git.py
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Manage git repositories and configuration.
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
|
|
5
7
|
import re
|
|
6
8
|
|
|
7
9
|
from pyinfra import host
|
|
@@ -14,7 +16,7 @@ from .util.files import chown, unix_path_join
|
|
|
14
16
|
|
|
15
17
|
|
|
16
18
|
@operation()
|
|
17
|
-
def config(key, value, multi_value=False, repo=None):
|
|
19
|
+
def config(key: str, value: str, multi_value=False, repo: str | None = None):
|
|
18
20
|
"""
|
|
19
21
|
Manage git config for a repository or globally.
|
|
20
22
|
|
|
@@ -62,13 +64,13 @@ def config(key, value, multi_value=False, repo=None):
|
|
|
62
64
|
|
|
63
65
|
@operation()
|
|
64
66
|
def repo(
|
|
65
|
-
src,
|
|
66
|
-
dest,
|
|
67
|
-
branch=None,
|
|
67
|
+
src: str,
|
|
68
|
+
dest: str,
|
|
69
|
+
branch: str | None = None,
|
|
68
70
|
pull=True,
|
|
69
71
|
rebase=False,
|
|
70
|
-
user=None,
|
|
71
|
-
group=None,
|
|
72
|
+
user: str | None = None,
|
|
73
|
+
group: str | None = None,
|
|
72
74
|
ssh_keyscan=False,
|
|
73
75
|
update_submodules=False,
|
|
74
76
|
recursive_submodules=False,
|
|
@@ -155,19 +157,19 @@ def repo(
|
|
|
155
157
|
|
|
156
158
|
@operation()
|
|
157
159
|
def worktree(
|
|
158
|
-
worktree,
|
|
159
|
-
repo=None,
|
|
160
|
+
worktree: str,
|
|
161
|
+
repo: str | None = None,
|
|
160
162
|
detached=False,
|
|
161
|
-
new_branch=None,
|
|
162
|
-
commitish=None,
|
|
163
|
+
new_branch: str | None = None,
|
|
164
|
+
commitish: str | None = None,
|
|
163
165
|
pull=True,
|
|
164
166
|
rebase=False,
|
|
165
|
-
from_remote_branch=None,
|
|
167
|
+
from_remote_branch: tuple[str, str] | None = None,
|
|
166
168
|
present=True,
|
|
167
169
|
assume_repo_exists=False,
|
|
168
170
|
force=False,
|
|
169
|
-
user=None,
|
|
170
|
-
group=None,
|
|
171
|
+
user: str | None = None,
|
|
172
|
+
group: str | None = None,
|
|
171
173
|
):
|
|
172
174
|
"""
|
|
173
175
|
Manage git worktrees.
|
|
@@ -336,9 +338,9 @@ def worktree(
|
|
|
336
338
|
|
|
337
339
|
@operation()
|
|
338
340
|
def bare_repo(
|
|
339
|
-
path,
|
|
340
|
-
user=None,
|
|
341
|
-
group=None,
|
|
341
|
+
path: str,
|
|
342
|
+
user: str | None = None,
|
|
343
|
+
group: str | None = None,
|
|
342
344
|
present=True,
|
|
343
345
|
):
|
|
344
346
|
"""
|
pyinfra/operations/iptables.py
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
The iptables modules handles iptables rules
|
|
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.api.exceptions import OperationError
|
|
@@ -10,10 +12,10 @@ from pyinfra.facts.iptables import Ip6tablesChains, Ip6tablesRules, IptablesChai
|
|
|
10
12
|
|
|
11
13
|
@operation()
|
|
12
14
|
def chain(
|
|
13
|
-
chain,
|
|
15
|
+
chain: str,
|
|
14
16
|
present=True,
|
|
15
17
|
table="filter",
|
|
16
|
-
policy=None,
|
|
18
|
+
policy: str | None = None,
|
|
17
19
|
version=4,
|
|
18
20
|
):
|
|
19
21
|
"""
|
|
@@ -58,32 +60,32 @@ def chain(
|
|
|
58
60
|
|
|
59
61
|
@operation()
|
|
60
62
|
def rule(
|
|
61
|
-
chain,
|
|
62
|
-
jump,
|
|
63
|
-
present=True,
|
|
64
|
-
table="filter",
|
|
65
|
-
append=True,
|
|
66
|
-
version=4,
|
|
63
|
+
chain: str,
|
|
64
|
+
jump: str,
|
|
65
|
+
present: bool = True,
|
|
66
|
+
table: str = "filter",
|
|
67
|
+
append: bool = True,
|
|
68
|
+
version: int = 4,
|
|
67
69
|
# Core iptables filter arguments
|
|
68
|
-
protocol=None,
|
|
69
|
-
not_protocol=None,
|
|
70
|
-
source=None,
|
|
71
|
-
not_source=None,
|
|
72
|
-
destination=None,
|
|
73
|
-
not_destination=None,
|
|
74
|
-
in_interface=None,
|
|
75
|
-
not_in_interface=None,
|
|
76
|
-
out_interface=None,
|
|
77
|
-
not_out_interface=None,
|
|
70
|
+
protocol: str | None = None,
|
|
71
|
+
not_protocol: str | None = None,
|
|
72
|
+
source: str | None = None,
|
|
73
|
+
not_source: str | None = None,
|
|
74
|
+
destination: str | None = None,
|
|
75
|
+
not_destination: str | None = None,
|
|
76
|
+
in_interface: str | None = None,
|
|
77
|
+
not_in_interface: str | None = None,
|
|
78
|
+
out_interface: str | None = None,
|
|
79
|
+
not_out_interface: str | None = None,
|
|
78
80
|
# After-rule arguments
|
|
79
|
-
to_destination=None,
|
|
80
|
-
to_source=None,
|
|
81
|
-
to_ports=None,
|
|
82
|
-
log_prefix=None,
|
|
81
|
+
to_destination: str | None = None,
|
|
82
|
+
to_source: str | None = None,
|
|
83
|
+
to_ports: int | str | None = None,
|
|
84
|
+
log_prefix: str | None = None,
|
|
83
85
|
# Extras and extra shortcuts
|
|
84
|
-
destination_port=None,
|
|
85
|
-
source_port=None,
|
|
86
|
-
extras="",
|
|
86
|
+
destination_port: int | None = None,
|
|
87
|
+
source_port: int | None = None,
|
|
88
|
+
extras: str = "",
|
|
87
89
|
):
|
|
88
90
|
"""
|
|
89
91
|
Add/remove iptables rules.
|
pyinfra/operations/launchd.py
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Manage launchd services.
|
|
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.launchd import LaunchdStatus
|
|
@@ -11,10 +13,10 @@ from .util.service import handle_service_control
|
|
|
11
13
|
|
|
12
14
|
@operation()
|
|
13
15
|
def service(
|
|
14
|
-
service,
|
|
16
|
+
service: str,
|
|
15
17
|
running=True,
|
|
16
18
|
restarted=False,
|
|
17
|
-
command=None,
|
|
19
|
+
command: str | None = None,
|
|
18
20
|
):
|
|
19
21
|
"""
|
|
20
22
|
Manage the state of systemd managed services.
|
|
@@ -33,11 +35,8 @@ def service(
|
|
|
33
35
|
service,
|
|
34
36
|
host.get_fact(LaunchdStatus),
|
|
35
37
|
"launchctl {1} {0}",
|
|
36
|
-
# No support for restart/reload/command
|
|
37
38
|
running,
|
|
38
|
-
|
|
39
|
-
None,
|
|
40
|
-
None,
|
|
39
|
+
# No support for restart/reload/command
|
|
41
40
|
)
|
|
42
41
|
|
|
43
42
|
# No restart command, so just stop/start
|
pyinfra/operations/lxd.py
CHANGED
|
@@ -2,22 +2,25 @@
|
|
|
2
2
|
The LXD modules manage LXD containers
|
|
3
3
|
"""
|
|
4
4
|
|
|
5
|
+
from __future__ import annotations
|
|
6
|
+
|
|
7
|
+
from typing import Any
|
|
8
|
+
|
|
5
9
|
from pyinfra import host
|
|
6
10
|
from pyinfra.api import operation
|
|
7
11
|
from pyinfra.facts.lxd import LxdContainers
|
|
8
12
|
|
|
9
13
|
|
|
10
|
-
def get_container_named(name, containers):
|
|
14
|
+
def get_container_named(name: str, containers: list[dict[str, Any]]) -> dict[str, Any] | None:
|
|
11
15
|
for container in containers:
|
|
12
16
|
if container["name"] == name:
|
|
13
17
|
return container
|
|
14
|
-
|
|
15
|
-
return None
|
|
18
|
+
return None
|
|
16
19
|
|
|
17
20
|
|
|
18
21
|
@operation()
|
|
19
22
|
def container(
|
|
20
|
-
id,
|
|
23
|
+
id: str,
|
|
21
24
|
present=True,
|
|
22
25
|
image="ubuntu:16.04",
|
|
23
26
|
):
|
pyinfra/operations/mysql.py
CHANGED
|
@@ -13,6 +13,8 @@ See the example/mysql.py
|
|
|
13
13
|
|
|
14
14
|
"""
|
|
15
15
|
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
|
|
16
18
|
from pyinfra import host
|
|
17
19
|
from pyinfra.api import MaskString, OperationError, QuoteString, StringCommand, operation
|
|
18
20
|
from pyinfra.facts.mysql import (
|
|
@@ -26,13 +28,13 @@ from pyinfra.facts.mysql import (
|
|
|
26
28
|
|
|
27
29
|
@operation(is_idempotent=False)
|
|
28
30
|
def sql(
|
|
29
|
-
sql,
|
|
30
|
-
database=None,
|
|
31
|
+
sql: str,
|
|
32
|
+
database: str | None = None,
|
|
31
33
|
# Details for speaking to MySQL via `mysql` CLI
|
|
32
|
-
mysql_user=None,
|
|
33
|
-
mysql_password=None,
|
|
34
|
-
mysql_host=None,
|
|
35
|
-
mysql_port=None,
|
|
34
|
+
mysql_user: str | None = None,
|
|
35
|
+
mysql_password: str | None = None,
|
|
36
|
+
mysql_host: str | None = None,
|
|
37
|
+
mysql_port: int | None = None,
|
|
36
38
|
):
|
|
37
39
|
"""
|
|
38
40
|
Execute arbitrary SQL against MySQL.
|
|
@@ -54,27 +56,28 @@ def sql(
|
|
|
54
56
|
|
|
55
57
|
@operation()
|
|
56
58
|
def user(
|
|
57
|
-
user,
|
|
58
|
-
present=True,
|
|
59
|
-
user_hostname="localhost",
|
|
60
|
-
password=None,
|
|
61
|
-
privileges=None,
|
|
59
|
+
user: str,
|
|
60
|
+
present: bool = True,
|
|
61
|
+
user_hostname: str = "localhost",
|
|
62
|
+
password: str | None = None,
|
|
63
|
+
privileges: str | list[str] | None = None,
|
|
62
64
|
# MySQL REQUIRE SSL/TLS options
|
|
63
|
-
require=None, # SSL or X509
|
|
64
|
-
require_cipher=
|
|
65
|
-
require_issuer=
|
|
66
|
-
require_subject=
|
|
65
|
+
require: str | None = None, # SSL or X509
|
|
66
|
+
require_cipher: str | None = None,
|
|
67
|
+
require_issuer: str | None = None,
|
|
68
|
+
require_subject: str | None = None,
|
|
67
69
|
# MySQL WITH resource limit options
|
|
68
|
-
max_connections=None,
|
|
69
|
-
max_queries_per_hour=None,
|
|
70
|
-
max_updates_per_hour=None,
|
|
71
|
-
max_connections_per_hour=None,
|
|
70
|
+
max_connections: int | None = None,
|
|
71
|
+
max_queries_per_hour: int | None = None,
|
|
72
|
+
max_updates_per_hour: int | None = None,
|
|
73
|
+
max_connections_per_hour: int | None = None,
|
|
72
74
|
# Details for speaking to MySQL via `mysql` CLI via `mysql` CLI
|
|
73
|
-
mysql_user=None,
|
|
74
|
-
mysql_password=None,
|
|
75
|
-
mysql_host=None,
|
|
76
|
-
mysql_port=None,
|
|
75
|
+
mysql_user: str | None = None,
|
|
76
|
+
mysql_password: str | None = None,
|
|
77
|
+
mysql_host: str | None = None,
|
|
78
|
+
mysql_port: int | None = None,
|
|
77
79
|
):
|
|
80
|
+
...
|
|
78
81
|
"""
|
|
79
82
|
Add/remove/update MySQL users.
|
|
80
83
|
|
|
@@ -282,24 +285,25 @@ def user(
|
|
|
282
285
|
|
|
283
286
|
@operation()
|
|
284
287
|
def database(
|
|
285
|
-
database,
|
|
288
|
+
database: str,
|
|
286
289
|
# Desired database settings
|
|
287
|
-
present=True,
|
|
288
|
-
collate=None,
|
|
289
|
-
charset=None,
|
|
290
|
-
user=None,
|
|
291
|
-
user_hostname="localhost",
|
|
292
|
-
user_privileges="ALL",
|
|
290
|
+
present: bool = True,
|
|
291
|
+
collate: str | None = None,
|
|
292
|
+
charset: str | None = None,
|
|
293
|
+
user: str | None = None,
|
|
294
|
+
user_hostname: str = "localhost",
|
|
295
|
+
user_privileges: str | list[str] = "ALL",
|
|
293
296
|
# Details for speaking to MySQL via `mysql` CLI
|
|
294
|
-
mysql_user=None,
|
|
295
|
-
mysql_password=None,
|
|
296
|
-
mysql_host=None,
|
|
297
|
-
mysql_port=None,
|
|
297
|
+
mysql_user: str | None = None,
|
|
298
|
+
mysql_password: str | None = None,
|
|
299
|
+
mysql_host: str | None = None,
|
|
300
|
+
mysql_port: int | None = None,
|
|
298
301
|
):
|
|
302
|
+
...
|
|
299
303
|
"""
|
|
300
304
|
Add/remove MySQL databases.
|
|
301
305
|
|
|
302
|
-
+
|
|
306
|
+
+ database: the name of the database
|
|
303
307
|
+ present: whether the database should exist or not
|
|
304
308
|
+ collate: the collate to use when creating the database
|
|
305
309
|
+ charset: the charset to use when creating the database
|
|
@@ -384,18 +388,18 @@ def database(
|
|
|
384
388
|
|
|
385
389
|
@operation()
|
|
386
390
|
def privileges(
|
|
387
|
-
user,
|
|
388
|
-
privileges,
|
|
391
|
+
user: str,
|
|
392
|
+
privileges: str | list[str] | set[str],
|
|
389
393
|
user_hostname="localhost",
|
|
390
394
|
database="*",
|
|
391
395
|
table="*",
|
|
392
396
|
flush=True,
|
|
393
397
|
with_grant_option=False,
|
|
394
398
|
# Details for speaking to MySQL via `mysql` CLI
|
|
395
|
-
mysql_user=None,
|
|
396
|
-
mysql_password=None,
|
|
397
|
-
mysql_host=None,
|
|
398
|
-
mysql_port=None,
|
|
399
|
+
mysql_user: str | None = None,
|
|
400
|
+
mysql_password: str | None = None,
|
|
401
|
+
mysql_host: str | None = None,
|
|
402
|
+
mysql_port: int | None = None,
|
|
399
403
|
):
|
|
400
404
|
"""
|
|
401
405
|
Add/remove MySQL privileges for a user, either global, database or table specific.
|
|
@@ -524,13 +528,13 @@ _privileges = privileges # noqa: E305 (for use where kwarg is the same)
|
|
|
524
528
|
|
|
525
529
|
@operation(is_idempotent=False)
|
|
526
530
|
def dump(
|
|
527
|
-
dest,
|
|
528
|
-
database=None,
|
|
531
|
+
dest: str,
|
|
532
|
+
database: str | None = None,
|
|
529
533
|
# Details for speaking to MySQL via `mysql` CLI
|
|
530
|
-
mysql_user=None,
|
|
531
|
-
mysql_password=None,
|
|
532
|
-
mysql_host=None,
|
|
533
|
-
mysql_port=None,
|
|
534
|
+
mysql_user: str | None = None,
|
|
535
|
+
mysql_password: str | None = None,
|
|
536
|
+
mysql_host: str | None = None,
|
|
537
|
+
mysql_port: int | None = None,
|
|
534
538
|
):
|
|
535
539
|
"""
|
|
536
540
|
Dump a MySQL database into a ``.sql`` file. Requires ``mysqldump``.
|
|
@@ -565,13 +569,13 @@ def dump(
|
|
|
565
569
|
|
|
566
570
|
@operation(is_idempotent=False)
|
|
567
571
|
def load(
|
|
568
|
-
src,
|
|
569
|
-
database=None,
|
|
572
|
+
src: str,
|
|
573
|
+
database: str | None = None,
|
|
570
574
|
# Details for speaking to MySQL via `mysql` CLI
|
|
571
|
-
mysql_user=None,
|
|
572
|
-
mysql_password=None,
|
|
573
|
-
mysql_host=None,
|
|
574
|
-
mysql_port=None,
|
|
575
|
+
mysql_user: str | None = None,
|
|
576
|
+
mysql_password: str | None = None,
|
|
577
|
+
mysql_host: str | None = None,
|
|
578
|
+
mysql_port: int | None = None,
|
|
575
579
|
):
|
|
576
580
|
"""
|
|
577
581
|
Load ``.sql`` file into a database.
|
pyinfra/operations/npm.py
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Manage npm (aka node aka Node.js) 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.npm import NpmPackages
|
|
@@ -10,7 +12,12 @@ from .util.packaging import ensure_packages
|
|
|
10
12
|
|
|
11
13
|
|
|
12
14
|
@operation()
|
|
13
|
-
def packages(
|
|
15
|
+
def packages(
|
|
16
|
+
packages: str | list[str] | None = None,
|
|
17
|
+
present=True,
|
|
18
|
+
latest=False,
|
|
19
|
+
directory: str | None = None,
|
|
20
|
+
):
|
|
14
21
|
"""
|
|
15
22
|
Install/remove/update npm packages.
|
|
16
23
|
|
pyinfra/operations/openrc.py
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Manage OpenRC init services.
|
|
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.openrc import OpenrcEnabled, OpenrcStatus
|
|
@@ -11,12 +13,12 @@ from .util.service import handle_service_control
|
|
|
11
13
|
|
|
12
14
|
@operation()
|
|
13
15
|
def service(
|
|
14
|
-
service,
|
|
16
|
+
service: str,
|
|
15
17
|
running=True,
|
|
16
18
|
restarted=False,
|
|
17
19
|
reloaded=False,
|
|
18
|
-
command=None,
|
|
19
|
-
enabled=None,
|
|
20
|
+
command: str | None = None,
|
|
21
|
+
enabled: bool | None = None,
|
|
20
22
|
runlevel="default",
|
|
21
23
|
):
|
|
22
24
|
"""
|
pyinfra/operations/pacman.py
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Manage pacman packages. (Arch Linux package manager)
|
|
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.pacman import PacmanPackages, PacmanUnpackGroup
|
|
@@ -35,7 +37,7 @@ _update = update._inner # noqa: E305
|
|
|
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
|
update=False,
|
|
41
43
|
upgrade=False,
|
|
@@ -75,8 +77,5 @@ def packages(
|
|
|
75
77
|
present,
|
|
76
78
|
install_command="pacman --noconfirm -S",
|
|
77
79
|
uninstall_command="pacman --noconfirm -R",
|
|
78
|
-
expand_package_fact=lambda package: host.get_fact(
|
|
79
|
-
PacmanUnpackGroup,
|
|
80
|
-
name=package,
|
|
81
|
-
),
|
|
80
|
+
expand_package_fact=lambda package: host.get_fact(PacmanUnpackGroup, package=package),
|
|
82
81
|
)
|
pyinfra/operations/pip.py
CHANGED
|
@@ -3,6 +3,8 @@ Manage pip (python) packages. Compatible globally or inside
|
|
|
3
3
|
a virtualenv (virtual environment).
|
|
4
4
|
"""
|
|
5
5
|
|
|
6
|
+
from __future__ import annotations
|
|
7
|
+
|
|
6
8
|
from pyinfra import host
|
|
7
9
|
from pyinfra.api import operation
|
|
8
10
|
from pyinfra.facts.files import File
|
|
@@ -14,8 +16,8 @@ from .util.packaging import ensure_packages
|
|
|
14
16
|
|
|
15
17
|
@operation()
|
|
16
18
|
def virtualenv(
|
|
17
|
-
path,
|
|
18
|
-
python=None,
|
|
19
|
+
path: str,
|
|
20
|
+
python: str | None = None,
|
|
19
21
|
venv=False,
|
|
20
22
|
site_packages=False,
|
|
21
23
|
always_copy=False,
|
|
@@ -81,8 +83,8 @@ _virtualenv = virtualenv._inner # noqa
|
|
|
81
83
|
|
|
82
84
|
@operation()
|
|
83
85
|
def venv(
|
|
84
|
-
path,
|
|
85
|
-
python=None,
|
|
86
|
+
path: str,
|
|
87
|
+
python: str | None = None,
|
|
86
88
|
site_packages=False,
|
|
87
89
|
always_copy=False,
|
|
88
90
|
present=True,
|
|
@@ -117,14 +119,14 @@ def venv(
|
|
|
117
119
|
|
|
118
120
|
@operation()
|
|
119
121
|
def packages(
|
|
120
|
-
packages=None,
|
|
122
|
+
packages: str | list[str] | None = None,
|
|
121
123
|
present=True,
|
|
122
124
|
latest=False,
|
|
123
|
-
requirements=None,
|
|
125
|
+
requirements: str | None = None,
|
|
124
126
|
pip="pip",
|
|
125
|
-
virtualenv=None,
|
|
126
|
-
virtualenv_kwargs=None,
|
|
127
|
-
extra_install_args=None,
|
|
127
|
+
virtualenv: str | None = None,
|
|
128
|
+
virtualenv_kwargs: dict | None = None,
|
|
129
|
+
extra_install_args: str | None = None,
|
|
128
130
|
):
|
|
129
131
|
"""
|
|
130
132
|
Install/remove/update pip packages.
|
pyinfra/operations/pkg.py
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
Manage BSD packages and repositories. Note that BSD package names are case-sensitive.
|
|
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.files import File
|
|
@@ -12,7 +14,7 @@ from .util.packaging import ensure_packages
|
|
|
12
14
|
|
|
13
15
|
|
|
14
16
|
@operation()
|
|
15
|
-
def packages(packages=None, present=True, pkg_path=None):
|
|
17
|
+
def packages(packages: str | list[str] | None = None, present=True, pkg_path: str | None = None):
|
|
16
18
|
"""
|
|
17
19
|
Install/remove/update pkg packages. This will use ``pkg ...`` where available
|
|
18
20
|
(FreeBSD) and the ``pkg_*`` variants elsewhere.
|
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
|
|
@@ -35,7 +37,7 @@ _update = update._inner # noqa: E305
|
|
|
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,
|
pyinfra/operations/postgres.py
CHANGED
|
@@ -13,6 +13,8 @@ See example/postgresql.py for detailed example
|
|
|
13
13
|
|
|
14
14
|
"""
|
|
15
15
|
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
|
|
16
18
|
from pyinfra import host
|
|
17
19
|
from pyinfra.api import MaskString, StringCommand, operation
|
|
18
20
|
from pyinfra.facts.postgres import (
|
|
@@ -25,13 +27,13 @@ from pyinfra.facts.postgres import (
|
|
|
25
27
|
|
|
26
28
|
@operation(is_idempotent=False)
|
|
27
29
|
def sql(
|
|
28
|
-
sql,
|
|
29
|
-
database=None,
|
|
30
|
+
sql: str,
|
|
31
|
+
database: str | None = None,
|
|
30
32
|
# Details for speaking to PostgreSQL via `psql` CLI
|
|
31
|
-
psql_user=None,
|
|
32
|
-
psql_password=None,
|
|
33
|
-
psql_host=None,
|
|
34
|
-
psql_port=None,
|
|
33
|
+
psql_user: str | None = None,
|
|
34
|
+
psql_password: str | None = None,
|
|
35
|
+
psql_host: str | None = None,
|
|
36
|
+
psql_port: int | None = None,
|
|
35
37
|
):
|
|
36
38
|
"""
|
|
37
39
|
Execute arbitrary SQL against PostgreSQL.
|
|
@@ -53,21 +55,21 @@ def sql(
|
|
|
53
55
|
|
|
54
56
|
@operation()
|
|
55
57
|
def role(
|
|
56
|
-
role,
|
|
58
|
+
role: str,
|
|
57
59
|
present=True,
|
|
58
|
-
password=None,
|
|
60
|
+
password: str | None = None,
|
|
59
61
|
login=True,
|
|
60
62
|
superuser=False,
|
|
61
63
|
inherit=False,
|
|
62
64
|
createdb=False,
|
|
63
65
|
createrole=False,
|
|
64
66
|
replication=False,
|
|
65
|
-
connection_limit=None,
|
|
67
|
+
connection_limit: int | None = None,
|
|
66
68
|
# Details for speaking to PostgreSQL via `psql` CLI
|
|
67
|
-
psql_user=None,
|
|
68
|
-
psql_password=None,
|
|
69
|
-
psql_host=None,
|
|
70
|
-
psql_port=None,
|
|
69
|
+
psql_user: str | None = None,
|
|
70
|
+
psql_password: str | None = None,
|
|
71
|
+
psql_host: str | None = None,
|
|
72
|
+
psql_port: int | None = None,
|
|
71
73
|
):
|
|
72
74
|
"""
|
|
73
75
|
Add/remove PostgreSQL roles.
|
|
@@ -162,20 +164,20 @@ def role(
|
|
|
162
164
|
|
|
163
165
|
@operation()
|
|
164
166
|
def database(
|
|
165
|
-
database,
|
|
167
|
+
database: str,
|
|
166
168
|
present=True,
|
|
167
|
-
owner=None,
|
|
168
|
-
template=None,
|
|
169
|
-
encoding=None,
|
|
170
|
-
lc_collate=None,
|
|
171
|
-
lc_ctype=None,
|
|
172
|
-
tablespace=None,
|
|
173
|
-
connection_limit=None,
|
|
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,
|
|
174
176
|
# Details for speaking to PostgreSQL via `psql` CLI
|
|
175
|
-
psql_user=None,
|
|
176
|
-
psql_password=None,
|
|
177
|
-
psql_host=None,
|
|
178
|
-
psql_port=None,
|
|
177
|
+
psql_user: str | None = None,
|
|
178
|
+
psql_password: str | None = None,
|
|
179
|
+
psql_host: str | None = None,
|
|
180
|
+
psql_port: int | None = None,
|
|
179
181
|
):
|
|
180
182
|
"""
|
|
181
183
|
Add/remove PostgreSQL databases.
|
|
@@ -262,13 +264,13 @@ def database(
|
|
|
262
264
|
|
|
263
265
|
@operation(is_idempotent=False)
|
|
264
266
|
def dump(
|
|
265
|
-
dest,
|
|
266
|
-
database=None,
|
|
267
|
+
dest: str,
|
|
268
|
+
database: str | None = None,
|
|
267
269
|
# Details for speaking to PostgreSQL via `psql` CLI
|
|
268
|
-
psql_user=None,
|
|
269
|
-
psql_password=None,
|
|
270
|
-
psql_host=None,
|
|
271
|
-
psql_port=None,
|
|
270
|
+
psql_user: str | None = None,
|
|
271
|
+
psql_password: str | None = None,
|
|
272
|
+
psql_host: str | None = None,
|
|
273
|
+
psql_port: int | None = None,
|
|
272
274
|
):
|
|
273
275
|
"""
|
|
274
276
|
Dump a PostgreSQL database into a ``.sql`` file. Requires ``pg_dump``.
|
|
@@ -306,13 +308,13 @@ def dump(
|
|
|
306
308
|
|
|
307
309
|
@operation(is_idempotent=False)
|
|
308
310
|
def load(
|
|
309
|
-
src,
|
|
310
|
-
database=None,
|
|
311
|
+
src: str,
|
|
312
|
+
database: str | None = None,
|
|
311
313
|
# Details for speaking to PostgreSQL via `psql` CLI
|
|
312
|
-
psql_user=None,
|
|
313
|
-
psql_password=None,
|
|
314
|
-
psql_host=None,
|
|
315
|
-
psql_port=None,
|
|
314
|
+
psql_user: str | None = None,
|
|
315
|
+
psql_password: str | None = None,
|
|
316
|
+
psql_host: str | None = None,
|
|
317
|
+
psql_port: int | None = None,
|
|
316
318
|
):
|
|
317
319
|
"""
|
|
318
320
|
Load ``.sql`` file into a database.
|