pyinfra 3.0.1__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/operation.py +12 -10
- {pyinfra-3.0.1.dist-info → pyinfra-3.0.2.dist-info}/METADATA +1 -1
- {pyinfra-3.0.1.dist-info → pyinfra-3.0.2.dist-info}/RECORD +10 -10
- pyinfra_cli/main.py +8 -8
- pyinfra_cli/prints.py +1 -1
- tests/test_cli/test_cli_deploy.py +7 -2
- {pyinfra-3.0.1.dist-info → pyinfra-3.0.2.dist-info}/LICENSE.md +0 -0
- {pyinfra-3.0.1.dist-info → pyinfra-3.0.2.dist-info}/WHEEL +0 -0
- {pyinfra-3.0.1.dist-info → pyinfra-3.0.2.dist-info}/entry_points.txt +0 -0
- {pyinfra-3.0.1.dist-info → pyinfra-3.0.2.dist-info}/top_level.txt +0 -0
pyinfra/api/operation.py
CHANGED
|
@@ -60,7 +60,7 @@ class OperationMeta:
|
|
|
60
60
|
if self._commands is not None:
|
|
61
61
|
return (
|
|
62
62
|
"OperationMeta(executed=True, "
|
|
63
|
-
f"success={self.did_succeed}, hash={self._hash}, commands={len(self._commands)})"
|
|
63
|
+
f"success={self.did_succeed()}, hash={self._hash}, commands={len(self._commands)})"
|
|
64
64
|
)
|
|
65
65
|
return (
|
|
66
66
|
"OperationMeta(executed=False, "
|
|
@@ -87,6 +87,12 @@ class OperationMeta:
|
|
|
87
87
|
if not self.is_complete():
|
|
88
88
|
raise RuntimeError("Cannot evaluate operation result before execution")
|
|
89
89
|
|
|
90
|
+
@property
|
|
91
|
+
def executed(self) -> bool:
|
|
92
|
+
if self._commands is None:
|
|
93
|
+
return False
|
|
94
|
+
return len(self._commands) > 0
|
|
95
|
+
|
|
90
96
|
@property
|
|
91
97
|
def will_change(self) -> bool:
|
|
92
98
|
if self._maybe_is_change is not None:
|
|
@@ -100,16 +106,12 @@ class OperationMeta:
|
|
|
100
106
|
self._maybe_is_change = False
|
|
101
107
|
return False
|
|
102
108
|
|
|
103
|
-
def
|
|
109
|
+
def did_change(self) -> bool:
|
|
110
|
+
self._raise_if_not_complete()
|
|
104
111
|
return bool(self._success and len(self._commands or []) > 0)
|
|
105
112
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
return context.host.when(self._did_change)
|
|
109
|
-
|
|
110
|
-
@property
|
|
111
|
-
def did_not_change(self):
|
|
112
|
-
return context.host.when(lambda: not self._did_change())
|
|
113
|
+
def did_not_change(self) -> bool:
|
|
114
|
+
return not self.did_change()
|
|
113
115
|
|
|
114
116
|
def did_succeed(self, _raise_if_not_complete=True) -> bool:
|
|
115
117
|
if _raise_if_not_complete:
|
|
@@ -124,7 +126,7 @@ class OperationMeta:
|
|
|
124
126
|
@property
|
|
125
127
|
def changed(self) -> bool:
|
|
126
128
|
if self.is_complete():
|
|
127
|
-
return self.
|
|
129
|
+
return self.did_change()
|
|
128
130
|
return self.will_change
|
|
129
131
|
|
|
130
132
|
@property
|
|
@@ -17,7 +17,7 @@ pyinfra/api/exceptions.py,sha256=cCbUp1qN1QO0d9aAvOAbRgYpLi0vUI5j7ZqSjcD1_P8,186
|
|
|
17
17
|
pyinfra/api/facts.py,sha256=aMPtkB7vypyXRQDThjwJZzAnEgqjP0wrwyEhRHQf4Js,9449
|
|
18
18
|
pyinfra/api/host.py,sha256=3lRhlZDRKvCNvpziaTglExy2Ep1wd4YdmGDNY4emAdA,13466
|
|
19
19
|
pyinfra/api/inventory.py,sha256=nPITdNEJ7q71adIqS_OKHsMjD7amUuHEuTl6xzgh1Gk,7734
|
|
20
|
-
pyinfra/api/operation.py,sha256=
|
|
20
|
+
pyinfra/api/operation.py,sha256=Dp7pH9H3EYs7U1ZvquYUbOtWJPO9iIAa4H7GwXdxFxs,15170
|
|
21
21
|
pyinfra/api/operations.py,sha256=jvz9ISfwmQnAQVUKLnbrRdD9QHIAAfypo9l5b3fYG1w,10894
|
|
22
22
|
pyinfra/api/state.py,sha256=3dXRjeZJXnzLcbP9E4aogkRPwIg3_kK1h4Tf4FVZock,12622
|
|
23
23
|
pyinfra/api/util.py,sha256=qbrC-Hjvzre2_U0l3hHo4wzZBDFN-zcWBNoWQgIyXxE,12272
|
|
@@ -127,8 +127,8 @@ pyinfra_cli/commands.py,sha256=J-mCJYvDebJ8M7o3HreB2zToa871-xO6_KjVhPLeHho,1832
|
|
|
127
127
|
pyinfra_cli/exceptions.py,sha256=iptx9Zj1od7VgSbOyXs7P8tD4zAZ_fwrQFKPlpPrfS0,4806
|
|
128
128
|
pyinfra_cli/inventory.py,sha256=S8aSl8TrF72Ni7eHiB40GjtAJeqyB1VxHobG2k254hQ,10329
|
|
129
129
|
pyinfra_cli/log.py,sha256=7WEGtmf3ncF1BtXL2icUjyxeRKy-7XrCcQ2Hg4GWX5Y,2201
|
|
130
|
-
pyinfra_cli/main.py,sha256=
|
|
131
|
-
pyinfra_cli/prints.py,sha256=
|
|
130
|
+
pyinfra_cli/main.py,sha256=5VTniMcbKuIfjPTzaUklad5fM1BW7CUEARoSV9tPf1U,19954
|
|
131
|
+
pyinfra_cli/prints.py,sha256=TsRxJRkkF-Trgbm4WgH8Vwr5PcelS5rokcqHDYc2kB0,9169
|
|
132
132
|
pyinfra_cli/util.py,sha256=f3iGIPxlUiQJ5LmUGYbEz0QrySQAKmf9xov9WvHXbrk,6364
|
|
133
133
|
pyinfra_cli/virtualenv.py,sha256=6j9W54JkQLN02SrZZIVwszp0GxlaaDEUWFZjBDHIWNA,2466
|
|
134
134
|
tests/test_api/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
@@ -144,7 +144,7 @@ tests/test_api/test_api_operations.py,sha256=GUfnuHK2NoTAGdOT4AbytT9R8i3ZZIvGP7K
|
|
|
144
144
|
tests/test_api/test_api_util.py,sha256=uHv4oLpoy1_tzOoqFA1zpdvC74SvjitZbxQwp0dmjTs,1716
|
|
145
145
|
tests/test_cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
146
146
|
tests/test_cli/test_cli.py,sha256=IeWuhkhLzIkRbOEx5-yaW6xV5l4Y8fxaGaDGlMcOyYE,6016
|
|
147
|
-
tests/test_cli/test_cli_deploy.py,sha256=
|
|
147
|
+
tests/test_cli/test_cli_deploy.py,sha256=3tlXpN_ntCvZDeymfQKrZm0kgADkiLUIAGQg5V8-KrU,5079
|
|
148
148
|
tests/test_cli/test_cli_exceptions.py,sha256=02sjC6rMptuqchgcdjdsVNQbSQYW6HwGutSy6Q6sMs4,3088
|
|
149
149
|
tests/test_cli/test_cli_inventory.py,sha256=xlo-p3HdfVPNqxi7SknEZ2mWrKsdDaK3PoVN-tl95Z0,2394
|
|
150
150
|
tests/test_cli/test_cli_util.py,sha256=-Ehnj0cO-EkF-6KLxcPPcFeuAUMTz-fKITrxhuiYhV4,2562
|
|
@@ -160,9 +160,9 @@ tests/test_connectors/test_sshuserclient.py,sha256=2PQNLPhNL6lBACc6tQuXmPoog-9L6
|
|
|
160
160
|
tests/test_connectors/test_terraform.py,sha256=Z5MhgDeRDFumu-GlbjMD0ZRkecwBIPP8C8ZVg-mq7C8,3743
|
|
161
161
|
tests/test_connectors/test_util.py,sha256=hQir0WyjH0LEF6xvIyHNyqdI5pkJX6qUR9287MgO2bY,4647
|
|
162
162
|
tests/test_connectors/test_vagrant.py,sha256=27qRB7ftjEPaj4ejBNZ-rR4Ou1AD1VyVcf2XjwZPG3M,3640
|
|
163
|
-
pyinfra-3.0.
|
|
164
|
-
pyinfra-3.0.
|
|
165
|
-
pyinfra-3.0.
|
|
166
|
-
pyinfra-3.0.
|
|
167
|
-
pyinfra-3.0.
|
|
168
|
-
pyinfra-3.0.
|
|
163
|
+
pyinfra-3.0.2.dist-info/LICENSE.md,sha256=gwC95tUll0gwB32tHNkTAasN7Sb6vjWzXa305NwClbI,1076
|
|
164
|
+
pyinfra-3.0.2.dist-info/METADATA,sha256=CeBR5TFvTUFHJfa9l6NgUHm0SKfUXaZLWdAxi921QaU,8041
|
|
165
|
+
pyinfra-3.0.2.dist-info/WHEEL,sha256=DZajD4pwLWue70CAfc7YaxT1wLUciNBvN_TTcvXpltE,110
|
|
166
|
+
pyinfra-3.0.2.dist-info/entry_points.txt,sha256=BraEFyquy05M8ch33HZXOHoH_m2BTqejL3xX3NrpzOM,471
|
|
167
|
+
pyinfra-3.0.2.dist-info/top_level.txt,sha256=2K6D1mK35JTSEBgOfEPV-N-uA2SDErxGiE0J-HUMMVI,26
|
|
168
|
+
pyinfra-3.0.2.dist-info/RECORD,,
|
pyinfra_cli/main.py
CHANGED
|
@@ -361,6 +361,14 @@ def _main(
|
|
|
361
361
|
else:
|
|
362
362
|
logger.info("--> Detected changes:")
|
|
363
363
|
print_meta(state)
|
|
364
|
+
click.echo(
|
|
365
|
+
"""
|
|
366
|
+
Detected changes may not include every change pyinfra will execute.
|
|
367
|
+
Hidden side effects of operations may alter behaviour of future operations,
|
|
368
|
+
this will be shown in the results. The remote state will always be updated
|
|
369
|
+
to reflect the state defined by the input operations.""",
|
|
370
|
+
err=True,
|
|
371
|
+
)
|
|
364
372
|
|
|
365
373
|
# If --debug-facts or --debug-operations, print and exit
|
|
366
374
|
if debug_facts or debug_operations:
|
|
@@ -372,14 +380,6 @@ def _main(
|
|
|
372
380
|
if dry:
|
|
373
381
|
_exit()
|
|
374
382
|
|
|
375
|
-
click.echo(
|
|
376
|
-
"""
|
|
377
|
-
Detected changes may not include every change pyinfra will execute.
|
|
378
|
-
Hidden side effects of operations may alter behaviour of future operations,
|
|
379
|
-
this will be shown in the results. The remote state will always be updated
|
|
380
|
-
to reflect the state defined by the input operations.""",
|
|
381
|
-
err=True,
|
|
382
|
-
)
|
|
383
383
|
if (
|
|
384
384
|
can_diff
|
|
385
385
|
and not yes
|
pyinfra_cli/prints.py
CHANGED
|
@@ -278,7 +278,7 @@ def print_results(state: "State"):
|
|
|
278
278
|
|
|
279
279
|
op_meta = state.ops[host][op_hash].operation_meta
|
|
280
280
|
if op_meta.did_succeed(_raise_if_not_complete=False):
|
|
281
|
-
if op_meta.
|
|
281
|
+
if op_meta.did_change():
|
|
282
282
|
hosts_in_op_success.append(host.name)
|
|
283
283
|
else:
|
|
284
284
|
hosts_in_op_no_change.append(host.name)
|
|
@@ -33,10 +33,14 @@ class TestCliDeployState(PatchSSHTestCase):
|
|
|
33
33
|
assert list(op_meta.names)[0] == correct_op_name
|
|
34
34
|
|
|
35
35
|
for host in state.inventory:
|
|
36
|
+
executed = False
|
|
37
|
+
host_op = state.ops[host].get(op_hash)
|
|
38
|
+
if host_op:
|
|
39
|
+
executed = host_op.operation_meta.executed
|
|
36
40
|
if correct_host_names is True or host.name in correct_host_names:
|
|
37
|
-
|
|
41
|
+
assert executed is True
|
|
38
42
|
else:
|
|
39
|
-
|
|
43
|
+
assert executed is False
|
|
40
44
|
|
|
41
45
|
def test_deploy(self):
|
|
42
46
|
task_file_path = path.join("tasks", "a_task.py")
|
|
@@ -72,6 +76,7 @@ class TestCliDeployState(PatchSSHTestCase):
|
|
|
72
76
|
("Nested order loop 2/1", ("somehost", "anotherhost")),
|
|
73
77
|
("Nested order loop 2/2", ("somehost", "anotherhost")),
|
|
74
78
|
("Final limited operation", ("somehost",)),
|
|
79
|
+
("Second final limited operation", ("anotherhost", "someotherhost")),
|
|
75
80
|
]
|
|
76
81
|
|
|
77
82
|
# Run 3 iterations of the test - each time shuffling the order of the
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|