pyinfra 2.9.2__py2.py3-none-any.whl → 3.0b1__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.
Files changed (126) hide show
  1. pyinfra/api/__init__.py +3 -0
  2. pyinfra/api/arguments.py +261 -255
  3. pyinfra/api/arguments_typed.py +77 -0
  4. pyinfra/api/command.py +66 -53
  5. pyinfra/api/config.py +27 -22
  6. pyinfra/api/connect.py +1 -1
  7. pyinfra/api/connectors.py +2 -24
  8. pyinfra/api/deploy.py +21 -52
  9. pyinfra/api/exceptions.py +33 -8
  10. pyinfra/api/facts.py +77 -113
  11. pyinfra/api/host.py +150 -82
  12. pyinfra/api/inventory.py +17 -25
  13. pyinfra/api/operation.py +232 -198
  14. pyinfra/api/operations.py +102 -148
  15. pyinfra/api/state.py +137 -79
  16. pyinfra/api/util.py +55 -70
  17. pyinfra/connectors/base.py +150 -0
  18. pyinfra/connectors/chroot.py +160 -169
  19. pyinfra/connectors/docker.py +227 -237
  20. pyinfra/connectors/dockerssh.py +231 -253
  21. pyinfra/connectors/local.py +195 -207
  22. pyinfra/connectors/ssh.py +528 -615
  23. pyinfra/connectors/ssh_util.py +114 -0
  24. pyinfra/connectors/sshuserclient/client.py +5 -3
  25. pyinfra/connectors/terraform.py +86 -65
  26. pyinfra/connectors/util.py +212 -137
  27. pyinfra/connectors/vagrant.py +55 -48
  28. pyinfra/context.py +3 -2
  29. pyinfra/facts/docker.py +1 -0
  30. pyinfra/facts/files.py +45 -32
  31. pyinfra/facts/git.py +3 -1
  32. pyinfra/facts/gpg.py +1 -1
  33. pyinfra/facts/hardware.py +4 -2
  34. pyinfra/facts/iptables.py +5 -3
  35. pyinfra/facts/mysql.py +1 -0
  36. pyinfra/facts/postgres.py +168 -0
  37. pyinfra/facts/postgresql.py +5 -161
  38. pyinfra/facts/selinux.py +3 -1
  39. pyinfra/facts/server.py +77 -30
  40. pyinfra/facts/systemd.py +29 -12
  41. pyinfra/facts/sysvinit.py +10 -10
  42. pyinfra/facts/util/packaging.py +4 -2
  43. pyinfra/local.py +4 -5
  44. pyinfra/operations/apk.py +3 -3
  45. pyinfra/operations/apt.py +25 -47
  46. pyinfra/operations/brew.py +7 -14
  47. pyinfra/operations/bsdinit.py +4 -4
  48. pyinfra/operations/cargo.py +1 -1
  49. pyinfra/operations/choco.py +1 -1
  50. pyinfra/operations/dnf.py +4 -4
  51. pyinfra/operations/files.py +108 -321
  52. pyinfra/operations/gem.py +1 -1
  53. pyinfra/operations/git.py +6 -37
  54. pyinfra/operations/iptables.py +2 -10
  55. pyinfra/operations/launchd.py +1 -1
  56. pyinfra/operations/lxd.py +1 -9
  57. pyinfra/operations/mysql.py +5 -28
  58. pyinfra/operations/npm.py +1 -1
  59. pyinfra/operations/openrc.py +1 -1
  60. pyinfra/operations/pacman.py +3 -3
  61. pyinfra/operations/pip.py +14 -15
  62. pyinfra/operations/pkg.py +1 -1
  63. pyinfra/operations/pkgin.py +3 -3
  64. pyinfra/operations/postgres.py +347 -0
  65. pyinfra/operations/postgresql.py +17 -380
  66. pyinfra/operations/python.py +2 -17
  67. pyinfra/operations/selinux.py +5 -28
  68. pyinfra/operations/server.py +59 -84
  69. pyinfra/operations/snap.py +1 -3
  70. pyinfra/operations/ssh.py +8 -23
  71. pyinfra/operations/systemd.py +7 -7
  72. pyinfra/operations/sysvinit.py +3 -12
  73. pyinfra/operations/upstart.py +4 -4
  74. pyinfra/operations/util/__init__.py +12 -0
  75. pyinfra/operations/util/files.py +2 -2
  76. pyinfra/operations/util/packaging.py +6 -24
  77. pyinfra/operations/util/service.py +18 -37
  78. pyinfra/operations/vzctl.py +2 -2
  79. pyinfra/operations/xbps.py +3 -3
  80. pyinfra/operations/yum.py +4 -4
  81. pyinfra/operations/zypper.py +4 -4
  82. {pyinfra-2.9.2.dist-info → pyinfra-3.0b1.dist-info}/METADATA +19 -22
  83. pyinfra-3.0b1.dist-info/RECORD +163 -0
  84. pyinfra-3.0b1.dist-info/entry_points.txt +11 -0
  85. pyinfra_cli/__main__.py +2 -0
  86. pyinfra_cli/commands.py +7 -2
  87. pyinfra_cli/exceptions.py +83 -42
  88. pyinfra_cli/inventory.py +19 -4
  89. pyinfra_cli/log.py +17 -3
  90. pyinfra_cli/main.py +133 -90
  91. pyinfra_cli/prints.py +93 -129
  92. pyinfra_cli/util.py +60 -29
  93. tests/test_api/test_api.py +2 -0
  94. tests/test_api/test_api_arguments.py +13 -13
  95. tests/test_api/test_api_deploys.py +28 -29
  96. tests/test_api/test_api_facts.py +60 -98
  97. tests/test_api/test_api_operations.py +100 -200
  98. tests/test_cli/test_cli.py +18 -49
  99. tests/test_cli/test_cli_deploy.py +11 -37
  100. tests/test_cli/test_cli_exceptions.py +50 -19
  101. tests/test_cli/util.py +1 -1
  102. tests/test_connectors/test_chroot.py +6 -6
  103. tests/test_connectors/test_docker.py +4 -4
  104. tests/test_connectors/test_dockerssh.py +38 -50
  105. tests/test_connectors/test_local.py +11 -12
  106. tests/test_connectors/test_ssh.py +66 -107
  107. tests/test_connectors/test_terraform.py +9 -15
  108. tests/test_connectors/test_util.py +24 -46
  109. tests/test_connectors/test_vagrant.py +4 -4
  110. pyinfra/api/operation.pyi +0 -117
  111. pyinfra/connectors/ansible.py +0 -171
  112. pyinfra/connectors/mech.py +0 -186
  113. pyinfra/connectors/pyinfrawinrmsession/__init__.py +0 -28
  114. pyinfra/connectors/winrm.py +0 -320
  115. pyinfra/facts/windows.py +0 -366
  116. pyinfra/facts/windows_files.py +0 -90
  117. pyinfra/operations/windows.py +0 -59
  118. pyinfra/operations/windows_files.py +0 -551
  119. pyinfra-2.9.2.dist-info/RECORD +0 -170
  120. pyinfra-2.9.2.dist-info/entry_points.txt +0 -14
  121. tests/test_connectors/test_ansible.py +0 -64
  122. tests/test_connectors/test_mech.py +0 -126
  123. tests/test_connectors/test_winrm.py +0 -76
  124. {pyinfra-2.9.2.dist-info → pyinfra-3.0b1.dist-info}/LICENSE.md +0 -0
  125. {pyinfra-2.9.2.dist-info → pyinfra-3.0b1.dist-info}/WHEEL +0 -0
  126. {pyinfra-2.9.2.dist-info → pyinfra-3.0b1.dist-info}/top_level.txt +0 -0
@@ -35,7 +35,7 @@ def upgrade():
35
35
  _upgrade = upgrade # noqa: E305
36
36
 
37
37
 
38
- @operation
38
+ @operation()
39
39
  def packages(
40
40
  packages=None,
41
41
  present=True,
@@ -75,10 +75,10 @@ def packages(
75
75
  """
76
76
 
77
77
  if update:
78
- yield from _update()
78
+ yield from _update._inner()
79
79
 
80
80
  if upgrade:
81
- yield from _upgrade()
81
+ yield from _upgrade._inner()
82
82
 
83
83
  yield from ensure_packages(
84
84
  host,
@@ -97,10 +97,7 @@ def cask_args(host):
97
97
  return ("", " --cask") if new_cask_cli(host.get_fact(BrewVersion)) else ("cask ", "")
98
98
 
99
99
 
100
- @operation(
101
- is_idempotent=False,
102
- pipeline_facts={"brew_version": ""},
103
- )
100
+ @operation(is_idempotent=False)
104
101
  def cask_upgrade():
105
102
  """
106
103
  Upgrades all brew casks.
@@ -109,9 +106,7 @@ def cask_upgrade():
109
106
  yield "brew %supgrade%s" % cask_args(host)
110
107
 
111
108
 
112
- @operation(
113
- pipeline_facts={"brew_version": ""},
114
- )
109
+ @operation()
115
110
  def casks(
116
111
  casks=None,
117
112
  present=True,
@@ -143,7 +138,7 @@ def casks(
143
138
  """
144
139
 
145
140
  if upgrade:
146
- yield from cask_upgrade()
141
+ yield from cask_upgrade._inner()
147
142
 
148
143
  args = cask_args(host)
149
144
 
@@ -160,7 +155,7 @@ def casks(
160
155
  )
161
156
 
162
157
 
163
- @operation
158
+ @operation()
164
159
  def tap(src=None, present=True, url=None):
165
160
  """
166
161
  Add/remove brew taps.
@@ -219,7 +214,6 @@ def tap(src=None, present=True, url=None):
219
214
 
220
215
  if already_tapped:
221
216
  yield "brew untap {0}".format(src)
222
- taps.remove(src)
223
217
  return
224
218
 
225
219
  if not present:
@@ -232,5 +226,4 @@ def tap(src=None, present=True, url=None):
232
226
  cmd = " ".join([cmd, url])
233
227
 
234
228
  yield cmd
235
- taps.append(src)
236
229
  return
@@ -11,7 +11,7 @@ from . import files
11
11
  from .util.service import handle_service_control
12
12
 
13
13
 
14
- @operation
14
+ @operation()
15
15
  def service(
16
16
  service,
17
17
  running=True,
@@ -49,9 +49,9 @@ def service(
49
49
 
50
50
  # BSD init is simple, just add/remove <service>_enabled="YES"
51
51
  if isinstance(enabled, bool):
52
- yield from files.line(
53
- "/etc/rc.conf.local",
54
- "^{0}_enable=".format(service),
52
+ yield from files.line._inner(
53
+ path="/etc/rc.conf.local",
54
+ line="^{0}_enable=".format(service),
55
55
  replace='{0}_enable="YES"'.format(service),
56
56
  present=enabled,
57
57
  )
@@ -9,7 +9,7 @@ from pyinfra.facts.cargo import CargoPackages
9
9
  from .util.packaging import ensure_packages
10
10
 
11
11
 
12
- @operation
12
+ @operation()
13
13
  def packages(packages=None, present=True, latest=False):
14
14
  """
15
15
  Install/remove/update cargo packages.
@@ -9,7 +9,7 @@ from pyinfra.facts.choco import ChocoPackages
9
9
  from .util.packaging import ensure_packages
10
10
 
11
11
 
12
- @operation
12
+ @operation()
13
13
  def packages(packages=None, present=True, latest=False):
14
14
  """
15
15
  Add/remove/update ``choco`` packages.
pyinfra/operations/dnf.py CHANGED
@@ -35,7 +35,7 @@ def key(src):
35
35
  yield "rpm --import {0}".format(src)
36
36
 
37
37
 
38
- @operation
38
+ @operation()
39
39
  def repo(
40
40
  src,
41
41
  present=True,
@@ -94,7 +94,7 @@ def repo(
94
94
  )
95
95
 
96
96
 
97
- @operation
97
+ @operation()
98
98
  def rpm(src, present=True):
99
99
  # NOTE: if updating this docstring also update `yum.rpm`
100
100
  """
@@ -130,10 +130,10 @@ def update():
130
130
  yield "dnf update -y"
131
131
 
132
132
 
133
- _update = update # noqa: E305 (for use below where update is a kwarg)
133
+ _update = update._inner # noqa: E305 (for use below where update is a kwarg)
134
134
 
135
135
 
136
- @operation
136
+ @operation()
137
137
  def packages(
138
138
  packages=None,
139
139
  present=True,