|
20 | 20 | from automax.plugins.remote_utils import exec_remote, quote |
21 | 21 |
|
22 | 22 |
|
| 23 | +def _is_templated_path(value: str) -> bool: |
| 24 | + """Return true when validation must wait until job rendering.""" |
| 25 | + return "{{" in value or "{%" in value or "{#" in value |
| 26 | + |
| 27 | + |
23 | 28 | def _sftp(context: ExecutionContext): |
24 | 29 | if context.ssh_client is None: |
25 | 30 | raise RuntimeError("transfer plugin requires an SSH session") |
@@ -133,7 +138,10 @@ class TransferUploadPlugin(BasePlugin): |
133 | 138 |
|
134 | 139 | def validate(self, params: Dict[str, Any]) -> None: |
135 | 140 | super().validate(params) |
136 | | - src = Path(str(params["src"])).expanduser() |
| 141 | + src_value = str(params["src"]) |
| 142 | + if _is_templated_path(src_value): |
| 143 | + return |
| 144 | + src = Path(src_value).expanduser() |
137 | 145 | if not src.exists(): |
138 | 146 | raise PluginValidationError(f"transfer.upload source not found: {src}") |
139 | 147 | if src.is_dir() and not bool(params.get("recursive", False)): |
@@ -243,7 +251,10 @@ class TransferSyncPlugin(BasePlugin): |
243 | 251 |
|
244 | 252 | def validate(self, params: Dict[str, Any]) -> None: |
245 | 253 | super().validate(params) |
246 | | - src = Path(str(params["src"])).expanduser() |
| 254 | + src_value = str(params["src"]) |
| 255 | + if _is_templated_path(src_value): |
| 256 | + return |
| 257 | + src = Path(src_value).expanduser() |
247 | 258 | if not src.is_dir(): |
248 | 259 | raise PluginValidationError("transfer.sync source must be a directory") |
249 | 260 |
|
|
0 commit comments