File tree Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Expand file tree Collapse file tree 2 files changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -328,12 +328,18 @@ def _get_temp_directory(self):
328
328
329
329
return temp_directory
330
330
331
- def get_temp_filename (self , hash_key : Optional [str ] = None , hash_filename : bool = True ):
331
+ def get_temp_filename (
332
+ self ,
333
+ hash_key : Optional [str ] = None ,
334
+ hash_filename : bool = True ,
335
+ * ,
336
+ temp_directory : Optional [str ] = None ,
337
+ ):
332
338
"""
333
339
Generate a temporary filename for this deploy.
334
340
"""
335
341
336
- temp_directory = self ._get_temp_directory ()
342
+ temp_directory = temp_directory or self ._get_temp_directory ()
337
343
338
344
if not hash_key :
339
345
hash_key = str (uuid4 ())
Original file line number Diff line number Diff line change @@ -75,6 +75,7 @@ def download(
75
75
headers : dict [str , str ] | None = None ,
76
76
insecure = False ,
77
77
proxy : str | None = None ,
78
+ temp_dir : str | Path | None = None ,
78
79
):
79
80
"""
80
81
Download files from remote locations using ``curl`` or ``wget``.
@@ -93,6 +94,7 @@ def download(
93
94
+ headers: optional dictionary of headers to set for the HTTP request
94
95
+ insecure: disable SSL verification for the HTTP request
95
96
+ proxy: simple HTTP proxy through which we can download files, form `http://<yourproxy>:<port>`
97
+ + temp_dir: use this custom temporary directory during the download
96
98
97
99
**Example:**
98
100
@@ -148,7 +150,9 @@ def download(
148
150
149
151
# If we download, always do user/group/mode as SSH user may be different
150
152
if download :
151
- temp_file = host .get_temp_filename (dest )
153
+ temp_file = host .get_temp_filename (
154
+ dest , temp_directory = str (temp_dir ) if temp_dir is not None else None
155
+ )
152
156
153
157
curl_args : list [Union [str , StringCommand ]] = ["-sSLf" ]
154
158
wget_args : list [Union [str , StringCommand ]] = ["-q" ]
You can’t perform that action at this time.
0 commit comments