Skip to content

Commit ff4c332

Browse files
committed
rename dest argument to download_path
1 parent 181dcb3 commit ff4c332

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

plugins/modules/software_center_download.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,9 +48,9 @@
4848
- Download filename of the SAP software.
4949
required: false
5050
type: str
51-
dest:
51+
download_path:
5252
description:
53-
- Destination folder.
53+
- Destination folder path.
5454
required: true
5555
type: str
5656
deduplicate:
@@ -78,16 +78,16 @@
7878
community.sap_launchpad.sap_launchpad_software_center_download:
7979
suser_id: 'SXXXXXXXX'
8080
suser_password: 'password'
81-
softwarecenter_search_query:
81+
search_query:
8282
- 'SAPCAR_1324-80000936.EXE'
83-
dest: "/tmp/"
83+
download_path: "/tmp/"
8484
- name: Download using direct link and filename
8585
community.sap_launchpad.software_center_download:
8686
suser_id: 'SXXXXXXXX'
8787
suser_password: 'password'
8888
download_link: 'https://softwaredownloads.sap.com/file/0010000000048502015'
8989
download_filename: 'IW_FNDGC100.SAR'
90-
dest: "/tmp/"
90+
download_path: "/tmp/"
9191
'''
9292

9393
RETURN = r'''
@@ -127,7 +127,7 @@ def run_module():
127127
search_query=dict(type='str', required=False, default=''),
128128
download_link=dict(type='str', required=False, default=''),
129129
download_filename=dict(type='str', required=False, default=''),
130-
dest=dict(type='str', required=True),
130+
download_path=dict(type='str', required=True),
131131
dry_run=dict(type='bool', required=False, default=False),
132132
deduplicate=dict(type='str', required=False, default=''),
133133
search_alternatives=dict(type='bool', required=False, default=False)
@@ -151,9 +151,9 @@ def run_module():
151151
else:
152152
query = None
153153

154+
download_path = module.params['download_path']
154155
download_link= module.params.get('download_link')
155156
download_filename= module.params.get('download_filename')
156-
dest = module.params.get('dest')
157157
dry_run = module.params.get('dry_run')
158158
deduplicate = module.params.get('deduplicate')
159159
search_alternatives = module.params.get('search_alternatives')
@@ -184,7 +184,7 @@ def run_module():
184184

185185
# Search for existing files using exact filename
186186
filename = query if query else download_filename
187-
filename_exact = os.path.join(dest, filename)
187+
filename_exact = os.path.join(download_path, filename)
188188
result['filename'] = filename
189189

190190
if os.path.exists(filename_exact):
@@ -193,10 +193,10 @@ def run_module():
193193
module.exit_json(**result)
194194
else:
195195
# Exact file not found, search with pattern
196-
# pattern = dest + '/**/' + os.path.splitext(filename)[0] + '*' # old pattern
196+
# pattern = download_path + '/**/' + os.path.splitext(filename)[0] + '*' # old pattern
197197
filename_base = os.path.splitext(filename)[0]
198198
filename_ext = os.path.splitext(filename)[1]
199-
filename_pattern = os.path.join(dest, "**", filename_base + "*" + filename_ext)
199+
filename_pattern = os.path.join(download_path, "**", filename_base + "*" + filename_ext)
200200
filename_similar = glob.glob(filename_pattern, recursive=True)
201201

202202
# Skip if similar files were found and search_alternatives was not set.
@@ -219,15 +219,15 @@ def run_module():
219219
result['filename'] = download_filename
220220
result['alternative'] = True
221221

222-
filename_alternative_exact = os.path.join(dest, download_filename)
222+
filename_alternative_exact = os.path.join(download_path, download_filename)
223223
if os.path.exists(filename_alternative_exact):
224224
result['skipped'] = True
225225
result['msg'] = f"Alternative file already exists: {download_filename} - original file {query} is not available to download"
226226
module.exit_json(**result)
227227
else:
228228
filename_alternative_base = os.path.splitext(download_filename)[0]
229229
filename_alternative_ext = os.path.splitext(download_filename)[1]
230-
filename_alternative_pattern = os.path.join(dest, "**", filename_alternative_base + "*" + filename_alternative_ext)
230+
filename_alternative_pattern = os.path.join(download_path, "**", filename_alternative_base + "*" + filename_alternative_ext)
231231
filename_alternative_similar = glob.glob(filename_alternative_pattern, recursive=True)
232232

233233
# Skip if similar files were found and search_alternatives was not set.
@@ -253,7 +253,7 @@ def run_module():
253253
else:
254254
module.fail_json(msg="Download link {} is not available".format(download_link))
255255

256-
download_software(download_link, download_filename, dest)
256+
download_software(download_link, download_filename, download_path)
257257

258258
# Update final results json
259259
result['changed'] = True

0 commit comments

Comments
 (0)