You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by jl...@apache.org on 2015/03/13 07:15:49 UTC

ambari git commit: AMBARI-10026: Download logs are too verbose (Eugene Chekanskiy via jluniya)

Repository: ambari
Updated Branches:
  refs/heads/trunk ff8a0f04b -> 1ea0ffbfa


AMBARI-10026: Download logs are too verbose (Eugene Chekanskiy via jluniya)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/1ea0ffbf
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/1ea0ffbf
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/1ea0ffbf

Branch: refs/heads/trunk
Commit: 1ea0ffbfae782d7401044243e569f9374d6877c5
Parents: ff8a0f0
Author: Jayush Luniya <jl...@hortonworks.com>
Authored: Thu Mar 12 23:15:35 2015 -0700
Committer: Jayush Luniya <jl...@hortonworks.com>
Committed: Thu Mar 12 23:15:35 2015 -0700

----------------------------------------------------------------------
 .../src/main/python/ambari_commons/inet_utils.py          | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/1ea0ffbf/ambari-common/src/main/python/ambari_commons/inet_utils.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/ambari_commons/inet_utils.py b/ambari-common/src/main/python/ambari_commons/inet_utils.py
index f6211ff..45ce366 100644
--- a/ambari-common/src/main/python/ambari_commons/inet_utils.py
+++ b/ambari-common/src/main/python/ambari_commons/inet_utils.py
@@ -26,13 +26,13 @@ from exceptions import *
 from logging_utils import *
 from os_check import OSCheck
 
-def download_file(link, destination, chunk_size=16 * 1024):
+def download_file(link, destination, chunk_size=16 * 1024, progress_func = None):
   print_info_msg("Downloading {0} to {1}".format(link, destination))
   if os.path.exists(destination):
       print_warning_msg("File {0} already exists, assuming it was downloaded before".format(destination))
       return
 
-  force_download_file(link, destination, chunk_size)
+  force_download_file(link, destination, chunk_size, progress_func = progress_func)
 
 
 def download_progress(file_name, downloaded_size, blockSize, totalSize):
@@ -73,7 +73,7 @@ def find_range_components(meta):
   return (file_size, seek_pos)
 
 
-def force_download_file(link, destination, chunk_size = 16 * 1024, progress_func = download_progress):
+def force_download_file(link, destination, chunk_size = 16 * 1024, progress_func = None):
   request = urllib2.Request(link)
 
   if os.path.exists(destination) and not os.path.isfile(destination):
@@ -127,8 +127,8 @@ def force_download_file(link, destination, chunk_size = 16 * 1024, progress_func
 
         file_size_dl += len(buffer)
         f.write(buffer)
-
-        progress_func(file_name, file_size_dl, chunk_size, file_size)
+        if progress_func is not None:
+          progress_func(file_name, file_size_dl, chunk_size, file_size)
     finally:
       f.close()