Skip to content

Commit

Permalink
URLGetter outputs the curl command with max verbosity
Browse files Browse the repository at this point in the history
  • Loading branch information
nmcspadden committed Nov 27, 2019
1 parent eb9a3ee commit 7c24a05
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions Code/autopkglib/URLGetter.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,23 +181,19 @@ def execute_curl(self, curl_cmd, text=True):

def download_with_curl(self, curl_cmd, text=True):
"""Launch curl, return its output, and handle failures."""

proc_stdout, proc_stderr, retcode = self.execute_curl(curl_cmd, text)

self.output(f"Curl command: {curl_cmd}", verbose_level=4)
if retcode: # Non-zero exit code from curl => problem with download
curl_err = self.parse_curl_error(proc_stderr)
raise ProcessorError(f"curl failure: {curl_err} (exit code {retcode})")

return proc_stdout

def download(self, url, headers=None, text=False):
"""Download content with default curl options"""

curl_cmd = self.prepare_curl_cmd()
self.add_curl_headers(curl_cmd, headers)
curl_cmd.append(url)
output = self.download_with_curl(curl_cmd, text)

return output

def main(self):
Expand Down

0 comments on commit 7c24a05

Please sign in to comment.