Skip to content

Commit e729079

Browse files
committed
Remove redundant transfer sync wrapper
1 parent cd7a23a commit e729079

11 files changed

Lines changed: 9 additions & 96 deletions

File tree

docs/guides/ssh-smoke.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ remote user. It covers:
4848
- `fs.file.line`, `fs.file.replace`, `fs.object.copy`, `fs.object.move`, `fs.symlink.create`, `fs.symlink.remove`
4949
- `fs.object.find`, `fs.permission.mode`
5050
- `data.archive.tar.create`, `data.archive.tar.extract`, `data.archive.zip.create`, `data.archive.zip.extract`
51-
- `data.transfer.upload`, `data.transfer.download`, `data.transfer.sync`
51+
- `data.transfer.upload`, `data.transfer.download`, `data.transfer.rsync`
5252
- `system.process.wait`
5353
- `storage.usage.disk_check`, `network.connectivity.port_check`
5454
- artifact capture for stdout/stderr/data

docs/plugins/generated.md

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1263,39 +1263,6 @@ with:
12631263
dest: /tmp/dest
12641264
```
12651265

1266-
### `data.transfer.sync`
1267-
1268-
Sync a local directory tree to a remote directory.
1269-
1270-
- Remote session: `true`
1271-
- Dry-run support: `true`
1272-
- Check mode support: `false`
1273-
1274-
| Parameter | Required | Type | Default | Description |
1275-
|---|---:|---|---|---|
1276-
| `src` | yes | `path` | | Source path. |
1277-
| `dest` | yes | `path` | | Destination path. |
1278-
1279-
Result fields:
1280-
1281-
- `changed`: Whether the plugin changed the target or controller state.
1282-
- `message`: Human-readable result message.
1283-
- `rc`: Process or command return code when applicable.
1284-
- `stdout`: Captured standard output when applicable.
1285-
- `stderr`: Captured standard error when applicable.
1286-
- `data`: Plugin-specific structured result data.
1287-
- `data.src`: Local source directory.
1288-
- `data.dest`: Remote destination directory.
1289-
1290-
Example:
1291-
1292-
```yaml
1293-
use: data.transfer.sync
1294-
with:
1295-
src: /tmp/source
1296-
dest: /tmp/dest
1297-
```
1298-
12991266
### `data.transfer.upload`
13001267

13011268
Upload a local file or directory to a remote target.

docs/plugins/index.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ data.restore.preview
5353
data.restore.verify
5454
data.transfer.download
5555
data.transfer.rsync
56-
data.transfer.sync
5756
data.transfer.upload
5857
database.mysql.check
5958
database.mysql.query

docs/plugins/transfer.md

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ Uploads a local file or directory to the remote target. Directory upload require
2020
dest: /tmp/myapp.tar.gz
2121
```
2222
23+
For small local directory trees, use `data.transfer.upload` with `recursive: true`. This uses the active SSH/SFTP connection and does not delete remote files that are missing locally. For large or incremental directory trees, use `data.transfer.rsync`.
24+
2325
## `data.transfer.download`
2426

2527
Downloads a remote file or directory to the controller. Directory download requires `recursive: true`.
@@ -32,21 +34,6 @@ Downloads a remote file or directory to the controller. Directory download requi
3234
dest: ./artifacts/{{ server.name }}/app.log
3335
```
3436

35-
## `data.transfer.sync`
36-
37-
Synchronizes a local tree to a remote destination.
38-
39-
```yaml
40-
- id: sync_templates
41-
use: data.transfer.sync
42-
with:
43-
src: ./files/
44-
dest: /opt/myapp/files/
45-
```
46-
47-
Use `data.transfer.sync` for small operational trees. It uploads local content to the remote directory and does not currently delete remote files that are missing locally. For very large trees, prefer a specialized artifact or package distribution mechanism.
48-
49-
5037
## Rsync transfers
5138

5239
`data.transfer.rsync` uses the controller-side `rsync` executable and the current

examples/runbooks/runbooks/62-data-transfer.check.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@ tasks:
1717
- id: data_transfer_rsync
1818
use: data.transfer.rsync
1919
with: {src: docs, dest: /tmp/dest}
20-
- id: data_transfer_sync
21-
use: data.transfer.sync
22-
with: {src: docs, dest: /tmp/dest}
2320
- id: data_transfer_upload
2421
use: data.transfer.upload
2522
with: {src: README.md, dest: /tmp/dest}

scripts/ssh-smoke.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,11 +181,12 @@ tasks:
181181
src: ${TMP_DIR}/payload/dir
182182
dest: ${WORK_DIR}/uploaded-dir
183183
recursive: true
184-
- id: sync_dir
185-
use: data.transfer.sync
184+
- id: upload_tree
185+
use: data.transfer.upload
186186
with:
187187
src: ${TMP_DIR}/payload
188188
dest: ${WORK_DIR}/synced
189+
recursive: true
189190
- id: download_file
190191
use: data.transfer.download
191192
with:

src/automax/plugins/manual_preview.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,6 @@ def fallback_manual_commands(plugin_name: str, params: Dict[str, Any], context:
331331
return [f"scp{_ssh_opts(params)} {_q(str(src))} {_q(str(dest))}"]
332332
if plugin_name == "data.transfer.upload":
333333
return [f"scp{_ssh_opts(params)} {_q(str(src))} {_q(str(dest))}"]
334-
if plugin_name == "data.transfer.sync":
335334
return [f"rsync -a {_q(str(src))}/ {_q(str(dest))}/"]
336335

337336
if plugin_name in {"system.cron.entry.add", "system.cron.file"}:

src/automax/plugins/metadata.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,6 @@
411411
"os.package.facts": {"data.packages": "Installed package facts."},
412412
"system.service.facts": {"data.services": "systemd service facts."},
413413
"security.sudo.dropin": {"data.path": "Installed sudoers drop-in path."},
414-
"data.transfer.sync": {"data.src": "Local source directory.", "data.dest": "Remote destination directory."},
415414
}
416415

417416
SAMPLE_VALUES: dict[str, Any] = {

src/automax/plugins/registry.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,6 @@ def build_builtin_registry(extra_plugin_paths: Iterable[str] = ()) -> PluginRegi
448448
from automax.plugins.transfer import (
449449
TransferDownloadPlugin,
450450
ExtendedTransferRsyncPlugin,
451-
TransferSyncPlugin,
452451
TransferUploadPlugin,
453452
)
454453
from automax.plugins.users_extra import (
@@ -716,7 +715,6 @@ def build_builtin_registry(extra_plugin_paths: Iterable[str] = ()) -> PluginRegi
716715
TransferUploadPlugin(),
717716
TransferDownloadPlugin(),
718717
ExtendedTransferRsyncPlugin(),
719-
TransferSyncPlugin(),
720718
FsCdPlugin(),
721719
FsDirCreatePlugin(),
722720
FsDirRemovePlugin(),

src/automax/plugins/transfer.py

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -240,38 +240,6 @@ def execute(self, params: Dict[str, Any], context: ExecutionContext) -> PluginRe
240240
return PluginResult.success(changed=True, data={"src": src, "dest": str(dest)})
241241

242242

243-
class TransferSyncPlugin(BasePlugin):
244-
"""Upload a local directory tree to a remote directory."""
245-
246-
name = "data.transfer.sync"
247-
description = "Sync a local directory tree to a remote directory."
248-
required_params = ("src", "dest")
249-
optional_params = ()
250-
opens_remote_session = True
251-
252-
def validate(self, params: Dict[str, Any]) -> None:
253-
super().validate(params)
254-
src_value = str(params["src"])
255-
if _is_templated_path(src_value):
256-
return
257-
src = Path(src_value).expanduser()
258-
if not src.is_dir():
259-
raise PluginValidationError("data.transfer.sync source must be a directory")
260-
261-
def execute(self, params: Dict[str, Any], context: ExecutionContext) -> PluginResult:
262-
self.validate(params)
263-
src = Path(str(params["src"])).expanduser()
264-
dest = str(params["dest"])
265-
sftp = _sftp(context)
266-
try:
267-
_upload_dir(context, sftp, src, dest)
268-
finally:
269-
sftp.close()
270-
if params.get("checksum"):
271-
exec_remote(context, f"sha256sum {quote(dest)} | awk '{{print $1}}' | grep -Fx -- {quote(params['checksum'])}")
272-
_remote_apply_attrs(context, dest, params, recursive=src.is_dir())
273-
return PluginResult.success(changed=True, data={"src": str(src), "dest": dest})
274-
275243

276244
class TransferRsyncPlugin(BasePlugin):
277245
"""Synchronize files using the local rsync executable."""

0 commit comments

Comments
 (0)