ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From yus...@apache.org
Subject [2/2] ambari git commit: Revert "AMBARI-9581. curl unable to connect to Ambari when SSLv3 and TLSv1 is disabled (aonishuk)"
Date Thu, 12 Feb 2015 05:00:58 GMT
Revert "AMBARI-9581. curl unable to connect to Ambari when SSLv3 and TLSv1 is disabled (aonishuk)"

Unit test failures.
This reverts commit 4a25974b195aadb6ff12534e383e72b4aae6c5fb.


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

Branch: refs/heads/trunk
Commit: e757885683d769da5b84257b2ae115427aadce1e
Parents: 590770a
Author: Yusaku Sako <yusaku@hortonworks.com>
Authored: Wed Feb 11 20:53:49 2015 -0800
Committer: Yusaku Sako <yusaku@hortonworks.com>
Committed: Wed Feb 11 20:53:49 2015 -0800

----------------------------------------------------------------------
 .../ambari_agent/AlertSchedulerHandler.py       |  5 +-
 .../src/main/python/ambari_agent/Controller.py  |  2 +-
 .../python/ambari_agent/alerts/script_alert.py  |  5 +-
 .../resource_management/core/constants.py       | 34 ++++++++++
 .../resource_management/core/environment.py     |  9 ++-
 .../python/resource_management/core/source.py   | 71 +++++++-------------
 .../libraries/functions/__init__.py             |  1 -
 .../libraries/functions/constants.py            | 36 ----------
 .../libraries/script/__init__.py                |  2 +-
 .../libraries/script/script.py                  |  3 +-
 .../package/scripts/setup_ranger_hbase.py       | 12 +++-
 .../package/scripts/namenode_upgrade.py         |  2 +-
 .../package/scripts/setup_ranger_hdfs.py        | 12 +++-
 .../HIVE/0.12.0.2.0/package/scripts/hive.py     | 27 ++++++--
 .../package/scripts/setup_ranger_hive.py        | 12 +++-
 .../package/scripts/setup_ranger_knox.py        | 12 +++-
 .../OOZIE/4.0.0.2.0/package/scripts/oozie.py    | 26 +++++--
 .../package/scripts/oozie_server_upgrade.py     |  2 +-
 .../0.4.0/package/scripts/setup_ranger.py       | 12 +++-
 .../package/scripts/setup_ranger_storm.py       | 12 +++-
 .../before-ANY/scripts/shared_initialization.py | 17 +++--
 .../scripts/shared_initialization.py            | 16 +++--
 .../scripts/shared_initialization.py            | 23 ++++---
 .../stacks/2.0.6/HIVE/test_hive_client.py       | 10 +--
 .../stacks/2.0.6/HIVE/test_hive_metastore.py    | 14 ++--
 .../stacks/2.0.6/HIVE/test_hive_server.py       | 14 ++--
 .../2.0.6/hooks/before-ANY/test_before_any.py   | 10 +--
 .../hooks/before-INSTALL/test_before_install.py | 11 ++-
 .../stacks/2.1/HIVE/test_hive_metastore.py      | 14 ++--
 .../src/test/python/stacks/utils/RMFTestCase.py | 11 +--
 30 files changed, 247 insertions(+), 190 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/e7578856/ambari-agent/src/main/python/ambari_agent/AlertSchedulerHandler.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/AlertSchedulerHandler.py b/ambari-agent/src/main/python/ambari_agent/AlertSchedulerHandler.py
index 87295d2..66b1758 100644
--- a/ambari-agent/src/main/python/ambari_agent/AlertSchedulerHandler.py
+++ b/ambari-agent/src/main/python/ambari_agent/AlertSchedulerHandler.py
@@ -53,7 +53,7 @@ class AlertSchedulerHandler():
   }
 
 
-  def __init__(self, cachedir, stacks_dir, common_services_dir, host_scripts_dir, config, in_minutes=True):
+  def __init__(self, cachedir, stacks_dir, common_services_dir, host_scripts_dir, in_minutes=True):
     self.cachedir = cachedir
     self.stacks_dir = stacks_dir
     self.common_services_dir = common_services_dir
@@ -69,7 +69,6 @@ class AlertSchedulerHandler():
     self._collector = AlertCollector()
     self.__scheduler = Scheduler(AlertSchedulerHandler.APS_CONFIG)
     self.__in_minutes = in_minutes
-    self.config = config
     self.__config_maps = {}
 
 
@@ -282,7 +281,7 @@ class AlertSchedulerHandler():
       source['stacks_directory'] = self.stacks_dir
       source['common_services_directory'] = self.common_services_dir
       source['host_scripts_directory'] = self.host_scripts_dir
-      alert = ScriptAlert(json_definition, source, self.config)
+      alert = ScriptAlert(json_definition, source)
     elif source_type == AlertSchedulerHandler.TYPE_WEB:
       alert = WebAlert(json_definition, source)
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/e7578856/ambari-agent/src/main/python/ambari_agent/Controller.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/Controller.py b/ambari-agent/src/main/python/ambari_agent/Controller.py
index d597bca..f8a9f04 100644
--- a/ambari-agent/src/main/python/ambari_agent/Controller.py
+++ b/ambari-agent/src/main/python/ambari_agent/Controller.py
@@ -91,7 +91,7 @@ class Controller(threading.Thread):
     alerts_cache_dir = os.path.join(cache_dir, 'alerts')
     
     self.alert_scheduler_handler = AlertSchedulerHandler(alerts_cache_dir, 
-        stacks_cache_dir, common_services_cache_dir, host_scripts_cache_dir, config)
+        stacks_cache_dir, common_services_cache_dir, host_scripts_cache_dir)
 
 
   def __del__(self):

http://git-wip-us.apache.org/repos/asf/ambari/blob/e7578856/ambari-agent/src/main/python/ambari_agent/alerts/script_alert.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/alerts/script_alert.py b/ambari-agent/src/main/python/ambari_agent/alerts/script_alert.py
index 35cd42e..660bddf 100644
--- a/ambari-agent/src/main/python/ambari_agent/alerts/script_alert.py
+++ b/ambari-agent/src/main/python/ambari_agent/alerts/script_alert.py
@@ -29,7 +29,7 @@ from symbol import parameters
 logger = logging.getLogger()
 
 class ScriptAlert(BaseAlert):
-  def __init__(self, alert_meta, alert_source_meta, config):
+  def __init__(self, alert_meta, alert_source_meta):
     """ ScriptAlert reporting structure is output from the script itself """
     
     alert_source_meta['reporting'] = {
@@ -41,7 +41,6 @@ class ScriptAlert(BaseAlert):
     
     super(ScriptAlert, self).__init__(alert_meta, alert_source_meta)
     
-    self.config = config
     self.path = None
     self.stacks_dir = None
     self.common_services_dir = None
@@ -91,7 +90,7 @@ class ScriptAlert(BaseAlert):
       matchObj = re.match( r'((.*)services\/(.*)\/package\/)', self.path_to_script)
       if matchObj:
         basedir = matchObj.group(1)
-        with Environment(basedir, tmp_dir=self.config.get.get('agent', 'tmp_dir')) as env:
+        with Environment(basedir) as env:
           return cmd_module.execute(parameters, self.host_name)
       else:
         return cmd_module.execute(parameters, self.host_name)

http://git-wip-us.apache.org/repos/asf/ambari/blob/e7578856/ambari-common/src/main/python/resource_management/core/constants.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/core/constants.py b/ambari-common/src/main/python/resource_management/core/constants.py
new file mode 100644
index 0000000..4e4a89e
--- /dev/null
+++ b/ambari-common/src/main/python/resource_management/core/constants.py
@@ -0,0 +1,34 @@
+#!/usr/bin/env python
+
+'''
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+    http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+'''
+
+class Direction:
+  """
+  Rolling Upgrade direction
+  """
+  UPGRADE = "upgrade"
+  DOWNGRADE = "downgrade"
+
+class SafeMode:
+  """
+  Namenode Safe Mode state
+  """
+  ON = "ON"
+  OFF = "OFF"
+  UNKNOWN = "UNKNOWN"
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/e7578856/ambari-common/src/main/python/resource_management/core/environment.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/core/environment.py b/ambari-common/src/main/python/resource_management/core/environment.py
index bb54d5f..b96765e 100644
--- a/ambari-common/src/main/python/resource_management/core/environment.py
+++ b/ambari-common/src/main/python/resource_management/core/environment.py
@@ -39,25 +39,24 @@ from resource_management.core.logger import Logger
 class Environment(object):
   _instances = []
 
-  def __init__(self, basedir=None, tmp_dir=None, test_mode=False, logging_level=logging.INFO):
+  def __init__(self, basedir=None, test_mode=False, logging_level=logging.INFO):
     """
     @param basedir: basedir/files, basedir/templates are the places where templates / static files
     are looked up
     @param test_mode: if this is enabled, resources won't be executed until manualy running env.run().
-    """   
-    self.reset(basedir, test_mode, tmp_dir)
+    """
+    self.reset(basedir, test_mode)
     
     if not Logger.logger:
       Logger.initialize_logger(logging_level)
 
-  def reset(self, basedir, test_mode, tmp_dir):
+  def reset(self, basedir, test_mode):
     self.system = System.get_instance()
     self.config = AttributeDictionary()
     self.resources = {}
     self.resource_list = []
     self.delayed_actions = set()
     self.test_mode = test_mode
-    self.tmp_dir = tmp_dir
     self.update_config({
       # current time
       'date': datetime.now(),

http://git-wip-us.apache.org/repos/asf/ambari/blob/e7578856/ambari-common/src/main/python/resource_management/core/source.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/core/source.py b/ambari-common/src/main/python/resource_management/core/source.py
index a786689..22e1c6d 100644
--- a/ambari-common/src/main/python/resource_management/core/source.py
+++ b/ambari-common/src/main/python/resource_management/core/source.py
@@ -22,14 +22,12 @@ Ambari Agent
 
 from __future__ import with_statement
 from resource_management.core.environment import Environment
-from resource_management.core.logger import Logger
-from resource_management.core.exceptions import Fail
 from resource_management.core.utils import checked_unite
 
 __all__ = ["Source", "Template", "InlineTemplate", "StaticFile", "DownloadSource"]
 
+import hashlib
 import os
-import time
 import urllib2
 import urlparse
 
@@ -138,53 +136,36 @@ else:
 
 
 class DownloadSource(Source):
-  """
-  redownload_files = True/False -- if file with the same name exists in tmp_dir
-  it won't be downloaded again (be if files are different this won't replace them)
-  
-  ignore_proxy = True/False -- determines if http_proxy / https_proxy environment variables
-  should be ignored or not
-  """
-    
-  def __init__(self, name, redownload_files=False, ignore_proxy=True):
+  def __init__(self, name, cache=True, md5sum=None):
     super(DownloadSource, self).__init__(name)
-
     self.url = self.name
-    self.cache = not redownload_files and bool(self.env.tmp_dir)
-    self.download_path = self.env.tmp_dir
-    self.ignore_proxy = ignore_proxy
+    self.md5sum = md5sum
+    self.cache = cache
+    if not 'download_path' in self.env.config:
+      self.env.config.download_path = '/var/tmp/downloads'
+    if not os.path.exists(self.env.config.download_path):
+      os.makedirs(self.env.config.download_path)
 
   def get_content(self):
-    if self.download_path and not os.path.exists(self.download_path):
-      raise Fail("Directory {0} doesn't exist, please provide valid download path".format(self.download_path))
-    
-    if urlparse.urlparse(self.url).path:
-      filename = os.path.basename(urlparse.urlparse(self.url).path)
-    else:
-      filename = 'index.html.{0}'.format(time.time())
-    
-    if self.cache:  
-      filepath = os.path.join(self.download_path, filename)
-    
-    if not self.cache or not os.path.exists(filepath):
-      Logger.info("Downloading the file from {0}".format(self.url))
-      
-      if self.ignore_proxy:
-        opener = urllib2.build_opener(urllib2.ProxyHandler({}))
-      else:
-        opener = urllib2.build_opener()
-      
-      req = urllib2.Request(self.url)
-      web_file = opener.open(req)
+    filepath = os.path.basename(urlparse.urlparse(self.url).path)
+    content = None
+    if not self.cache or not os.path.exists(
+      os.path.join(self.env.config.download_path, filepath)):
+      web_file = urllib2.urlopen(self.url)
       content = web_file.read()
-
-      if self.cache:
-        with open(filepath, 'w') as fp:
-          fp.write(content)
     else:
-      Logger.info("Not downloading the file from {0}, because {1} already exists".format(self.url, filepath))
-        
-      with open(filepath) as fp:
+      update = False
+      with open(os.path.join(self.env.config.download_path, filepath)) as fp:
         content = fp.read()
-
+      if self.md5sum:
+        m = hashlib.md5(content)
+        md5 = m.hexdigest()
+        if md5 != self.md5sum:
+          web_file = urllib2.urlopen(self.url)
+          content = web_file.read()
+          update = True
+      if self.cache and update:
+        with open(os.path.join(self.env.config.download_path, filepath),
+                  'w') as fp:
+          fp.write(content)
     return content

http://git-wip-us.apache.org/repos/asf/ambari/blob/e7578856/ambari-common/src/main/python/resource_management/libraries/functions/__init__.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/__init__.py b/ambari-common/src/main/python/resource_management/libraries/functions/__init__.py
index 44d235c..9b32b92 100644
--- a/ambari-common/src/main/python/resource_management/libraries/functions/__init__.py
+++ b/ambari-common/src/main/python/resource_management/libraries/functions/__init__.py
@@ -33,7 +33,6 @@ from resource_management.libraries.functions.get_port_from_url import *
 from resource_management.libraries.functions.hive_check import *
 from resource_management.libraries.functions.version import *
 from resource_management.libraries.functions.format_jvm_option import *
-from resource_management.libraries.functions.constants import *
 
 IS_WINDOWS = platform.system() == "Windows"
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/e7578856/ambari-common/src/main/python/resource_management/libraries/functions/constants.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/functions/constants.py b/ambari-common/src/main/python/resource_management/libraries/functions/constants.py
deleted file mode 100644
index 4f77552..0000000
--- a/ambari-common/src/main/python/resource_management/libraries/functions/constants.py
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/env python
-
-'''
-Licensed to the Apache Software Foundation (ASF) under one
-or more contributor license agreements.  See the NOTICE file
-distributed with this work for additional information
-regarding copyright ownership.  The ASF licenses this file
-to you under the Apache License, Version 2.0 (the
-"License"); you may not use this file except in compliance
-with the License.  You may obtain a copy of the License at
-
-    http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
-'''
-
-__all__ = ["Direction", "SafeMode"]
-
-class Direction:
-  """
-  Rolling Upgrade direction
-  """
-  UPGRADE = "upgrade"
-  DOWNGRADE = "downgrade"
-
-class SafeMode:
-  """
-  Namenode Safe Mode state
-  """
-  ON = "ON"
-  OFF = "OFF"
-  UNKNOWN = "UNKNOWN"
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/e7578856/ambari-common/src/main/python/resource_management/libraries/script/__init__.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/script/__init__.py b/ambari-common/src/main/python/resource_management/libraries/script/__init__.py
index 6e4cc09..72d3aaf 100644
--- a/ambari-common/src/main/python/resource_management/libraries/script/__init__.py
+++ b/ambari-common/src/main/python/resource_management/libraries/script/__init__.py
@@ -22,4 +22,4 @@ Ambari Agent
 
 from resource_management.libraries.script.script import *
 from resource_management.libraries.script.hook import *
-from resource_management.libraries.script.config_dictionary import *
+from resource_management.libraries.script.config_dictionary import *
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/e7578856/ambari-common/src/main/python/resource_management/libraries/script/script.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/script/script.py b/ambari-common/src/main/python/resource_management/libraries/script/script.py
index e470690..683397a 100644
--- a/ambari-common/src/main/python/resource_management/libraries/script/script.py
+++ b/ambari-common/src/main/python/resource_management/libraries/script/script.py
@@ -180,8 +180,7 @@ class Script(object):
     # Run class method depending on a command type
     try:
       method = self.choose_method_to_execute(command_name)
-      with Environment(self.basedir, tmp_dir=Script.tmp_dir) as env:
-        env.config.download_path = Script.tmp_dir
+      with Environment(self.basedir) as env:
         method(env)
 
         # For start actions, try to advertise the component's version

http://git-wip-us.apache.org/repos/asf/ambari/blob/e7578856/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/setup_ranger_hbase.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/setup_ranger_hbase.py b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/setup_ranger_hbase.py
index 97706f8..ef31ae7 100644
--- a/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/setup_ranger_hbase.py
+++ b/ambari-server/src/main/resources/common-services/HBASE/0.96.0.2.0/package/scripts/setup_ranger_hbase.py
@@ -31,9 +31,15 @@ def setup_ranger_hbase():
   import params
   
   if params.has_ranger_admin:
-    File(params.downloaded_custom_connector,
-         content = DownloadSource(params.driver_curl_source)
-    )
+
+    environment = {"no_proxy": format("{params.ambari_server_hostname}")}
+
+    Execute(('curl', '-kf', '-x', "", '--retry', '10', params.driver_curl_source, '-o',
+            params.downloaded_custom_connector),
+            not_if=format("test -f {params.downloaded_custom_connector}"),
+            path=["/bin", "/usr/bin/"],
+            environment=environment,
+            sudo=True)
 
     if not os.path.isfile(params.driver_curl_target):
       Execute(('cp', '--remove-destination', params.downloaded_custom_connector, params.driver_curl_target),

http://git-wip-us.apache.org/repos/asf/ambari/blob/e7578856/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/namenode_upgrade.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/namenode_upgrade.py b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/namenode_upgrade.py
index 60c8eb8..15d2b8e 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/namenode_upgrade.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/namenode_upgrade.py
@@ -23,7 +23,7 @@ from resource_management.core.resources.system import Execute
 from resource_management.libraries.functions.format import format
 from resource_management.libraries.functions.default import default
 from resource_management.core.shell import call
-from resource_management.libraries.functions import Direction, SafeMode
+from resource_management.core.constants import Direction, SafeMode
 from resource_management.core.exceptions import Fail
 
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/e7578856/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/setup_ranger_hdfs.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/setup_ranger_hdfs.py b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/setup_ranger_hdfs.py
index a99a005..df7063b 100644
--- a/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/setup_ranger_hdfs.py
+++ b/ambari-server/src/main/resources/common-services/HDFS/2.1.0.2.0/package/scripts/setup_ranger_hdfs.py
@@ -32,9 +32,15 @@ def setup_ranger_hdfs():
   import params
 
   if params.has_ranger_admin:
-    File(params.downloaded_custom_connector,
-         content = DownloadSource(params.driver_curl_source)
-    )
+
+    environment = {"no_proxy": format("{params.ambari_server_hostname}")}
+
+    Execute(('curl', '-kf', '-x', "", '--retry', '10', params.driver_curl_source, '-o',
+            params.downloaded_custom_connector),
+            not_if=format("test -f {params.downloaded_custom_connector}"),
+            path=["/bin", "/usr/bin/"],
+            environment=environment,
+            sudo=True)
 
     if not os.path.isfile(params.driver_curl_target):
       Execute(('cp', '--remove-destination', params.downloaded_custom_connector, params.driver_curl_target),

http://git-wip-us.apache.org/repos/asf/ambari/blob/e7578856/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py
index 7b0113b..b9677e7 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/hive.py
@@ -74,10 +74,19 @@ def hive(name=None):
 
   if name == 'metastore' or name == 'hiveserver2':
     jdbc_connector()
+    
+  environment = {
+    "no_proxy": format("{ambari_server_hostname}")
+  }
 
-  File(format("/usr/lib/ambari-agent/{check_db_connection_jar_name}"),
-       content = DownloadSource(format("{jdk_location}{check_db_connection_jar_name}")),
-  )
+  cmd = format("/bin/sh -c 'cd /usr/lib/ambari-agent/ && curl -kf -x \"\" "
+               "--retry 5 "
+               "{jdk_location}{check_db_connection_jar_name} "
+               "-o {check_db_connection_jar_name}'")
+
+  Execute(cmd,
+          not_if=format("[ -f {check_db_connection_jar} ]"),
+          environment = environment)
 
   if name == 'metastore':
     File(params.start_metastore_path,
@@ -196,10 +205,14 @@ def jdbc_connector():
     Execute(('rm', '-f', params.prepackaged_ojdbc_symlink),
             path=["/bin", "/usr/bin/"],
             sudo = True)
-    
-    File(params.downloaded_custom_connector,
-         content = DownloadSource(params.driver_curl_source),
-    )
+
+    Execute(('curl', '-kf', '-x', "", '--retry', '10', params.driver_curl_source, '-o',
+             params.downloaded_custom_connector),
+            not_if=format("test -f {downloaded_custom_connector}"),
+            path=["/bin", "/usr/bin/"],
+            environment=environment,
+            sudo = True)
+
 
     Execute(('cp', '--remove-destination', params.downloaded_custom_connector, params.target),
             #creates=params.target, TODO: uncomment after ranger_hive_plugin will not provide jdbc

http://git-wip-us.apache.org/repos/asf/ambari/blob/e7578856/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/setup_ranger_hive.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/setup_ranger_hive.py b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/setup_ranger_hive.py
index acaead3..410fb9a 100644
--- a/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/setup_ranger_hive.py
+++ b/ambari-server/src/main/resources/common-services/HIVE/0.12.0.2.0/package/scripts/setup_ranger_hive.py
@@ -31,9 +31,15 @@ def setup_ranger_hive():
   import params
 
   if params.has_ranger_admin:
-    File(params.ranger_downloaded_custom_connector,
-         content = DownloadSource(params.ranger_driver_curl_source),
-    )
+
+    environment = {"no_proxy": format("{params.ambari_server_hostname}")}
+
+    Execute(('curl', '-kf', '-x', "", '--retry', '10', params.ranger_driver_curl_source, '-o',
+            params.ranger_downloaded_custom_connector),
+            not_if=format("test -f {params.ranger_downloaded_custom_connector}"),
+            path=["/bin", "/usr/bin/"],
+            environment=environment,
+            sudo=True)
 
     if not os.path.isfile(params.ranger_driver_curl_target):
       Execute(('cp', '--remove-destination', params.ranger_downloaded_custom_connector, params.ranger_driver_curl_target),

http://git-wip-us.apache.org/repos/asf/ambari/blob/e7578856/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/setup_ranger_knox.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/setup_ranger_knox.py b/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/setup_ranger_knox.py
index 09e9325..b4bafac 100644
--- a/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/setup_ranger_knox.py
+++ b/ambari-server/src/main/resources/common-services/KNOX/0.5.0.2.2/package/scripts/setup_ranger_knox.py
@@ -31,9 +31,15 @@ def setup_ranger_knox():
   import params
 
   if params.has_ranger_admin:
-    File(params.downloaded_custom_connector,
-         content = DownloadSource(params.driver_curl_source),
-    )
+
+    environment = {"no_proxy": format("{params.ambari_server_hostname}")}
+
+    Execute(('curl', '-kf', '-x', "", '--retry', '10', params.driver_curl_source, '-o',
+            params.downloaded_custom_connector),
+            not_if=format("test -f {params.downloaded_custom_connector}"),
+            path=["/bin", "/usr/bin/"],
+            environment=environment,
+            sudo=True)
 
     if not os.path.isfile(params.driver_curl_target):
       Execute(('cp', '--remove-destination', params.downloaded_custom_connector, params.driver_curl_target),

http://git-wip-us.apache.org/repos/asf/ambari/blob/e7578856/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie.py b/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie.py
index 7d8322c..3fe6da4 100644
--- a/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie.py
+++ b/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie.py
@@ -76,12 +76,20 @@ def oozie(is_server=False # TODO: see if see can remove this
            group = params.user_group
     )
 
+  environment = {
+    "no_proxy": format("{ambari_server_hostname}")
+  }
+
   if params.jdbc_driver_name == "com.mysql.jdbc.Driver" or \
      params.jdbc_driver_name == "com.microsoft.sqlserver.jdbc.SQLServerDriver" or \
      params.jdbc_driver_name == "org.postgresql.Driver" or \
      params.jdbc_driver_name == "oracle.jdbc.driver.OracleDriver":
-    File(format("/usr/lib/ambari-agent/{check_db_connection_jar_name}"),
-      content = DownloadSource(format("{jdk_location}{check_db_connection_jar_name}")),
+    Execute(format("/bin/sh -c 'cd /usr/lib/ambari-agent/ &&\
+    curl -kf -x \"\" \
+    --retry 5 {jdk_location}{check_db_connection_jar_name}\
+     -o {check_db_connection_jar_name}'"),
+      not_if  = format("[ -f {check_db_connection_jar} ]"),
+      environment=environment
     )
   pass
 
@@ -149,9 +157,17 @@ def oozie_server_specific():
   if params.jdbc_driver_name=="com.mysql.jdbc.Driver" or \
      params.jdbc_driver_name == "com.microsoft.sqlserver.jdbc.SQLServerDriver" or \
      params.jdbc_driver_name=="oracle.jdbc.driver.OracleDriver":
-    File(params.downloaded_custom_connector,
-         content = DownloadSource(params.driver_curl_source),
-    )
+
+    environment = {
+      "no_proxy": format("{ambari_server_hostname}")
+    }
+
+    Execute(('curl', '-kf', '-x', "", '--retry', '10', params.driver_curl_source, '-o',
+             params.downloaded_custom_connector),
+            not_if=format("test -f {downloaded_custom_connector}"),
+            path=["/bin", "/usr/bin/"],
+            environment=environment,
+            sudo = True)
 
 
     Execute(('cp', '--remove-destination', params.downloaded_custom_connector, params.target),

http://git-wip-us.apache.org/repos/asf/ambari/blob/e7578856/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie_server_upgrade.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie_server_upgrade.py b/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie_server_upgrade.py
index c5b420f..e1356ca 100644
--- a/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie_server_upgrade.py
+++ b/ambari-server/src/main/resources/common-services/OOZIE/4.0.0.2.0/package/scripts/oozie_server_upgrade.py
@@ -24,9 +24,9 @@ import tempfile
 
 from resource_management.core import shell
 from resource_management.core.logger import Logger
+from resource_management.core.constants import Direction
 from resource_management.core.exceptions import Fail
 from resource_management.core.resources.system import Execute
-from resource_management.libraries.functions import Direction
 from resource_management.libraries.functions import format
 from resource_management.libraries.functions import compare_versions
 from resource_management.libraries.functions import format_hdp_stack_version

http://git-wip-us.apache.org/repos/asf/ambari/blob/e7578856/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/setup_ranger.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/setup_ranger.py b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/setup_ranger.py
index c37915a..fe1d995 100644
--- a/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/setup_ranger.py
+++ b/ambari-server/src/main/resources/common-services/RANGER/0.4.0/package/scripts/setup_ranger.py
@@ -28,9 +28,15 @@ def setup_ranger():
   import params
 
   if check_db_connnection():
-    File(params.downloaded_custom_connector,
-         content = DownloadSource(params.driver_curl_source)
-    )
+
+    environment = {"no_proxy": format("{params.ambari_server_hostname}")}
+
+    Execute(('curl', '-kf', '-x', "", '--retry', '10', params.driver_curl_source, '-o',
+            params.downloaded_custom_connector),
+            not_if=format("test -f {params.downloaded_custom_connector}"),
+            path=["/bin", "/usr/bin/"],
+            environment=environment,
+            sudo=True)
 
     if not os.path.isfile(params.driver_curl_target):
       Execute(('cp', '--remove-destination', params.downloaded_custom_connector, params.driver_curl_target),

http://git-wip-us.apache.org/repos/asf/ambari/blob/e7578856/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/setup_ranger_storm.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/setup_ranger_storm.py b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/setup_ranger_storm.py
index 9e687c8..d128cff 100644
--- a/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/setup_ranger_storm.py
+++ b/ambari-server/src/main/resources/common-services/STORM/0.9.1.2.1/package/scripts/setup_ranger_storm.py
@@ -32,9 +32,15 @@ def setup_ranger_storm():
   import params
 
   if params.has_ranger_admin and params.security_enabled:
-    File(params.downloaded_custom_connector,
-         content = DownloadSource(params.driver_curl_source)
-    )
+
+    environment = {"no_proxy": format("{params.ambari_server_hostname}")}
+
+    Execute(('curl', '-kf', '-x', "", '--retry', '10', params.driver_curl_source, '-o',
+            params.downloaded_custom_connector),
+            not_if=format("test -f {params.downloaded_custom_connector}"),
+            path=["/bin", "/usr/bin/"],
+            environment=environment,
+            sudo=True)
 
     if not os.path.isfile(params.driver_curl_target):
       Execute(('cp', '--remove-destination', params.downloaded_custom_connector, params.driver_curl_target),

http://git-wip-us.apache.org/repos/asf/ambari/blob/e7578856/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-ANY/scripts/shared_initialization.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-ANY/scripts/shared_initialization.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-ANY/scripts/shared_initialization.py
index 4c26b77..055ab40 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-ANY/scripts/shared_initialization.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-ANY/scripts/shared_initialization.py
@@ -29,13 +29,20 @@ def setup_jce():
   if not params.jdk_name:
     return
   
+  environment = {
+    "no_proxy": format("{ambari_server_hostname}")
+  }
+  
   if params.jce_policy_zip is not None:
     jce_curl_target = format("{artifact_dir}/{jce_policy_zip}")
-    Directory(params.artifact_dir,
-         recursive = True,
-    )
-    File(jce_curl_target,
-         content = DownloadSource(format("{jce_location}/{jce_policy_zip}")),
+    download_jce = format("mkdir -p {artifact_dir}; \
+    curl -kf -x \"\" --retry 10 \
+    {jce_location}/{jce_policy_zip} -o {jce_curl_target}")
+    Execute( download_jce,
+             path = ["/bin","/usr/bin/"],
+             not_if =format("test -e {jce_curl_target}"),
+             ignore_failures = True,
+             environment = environment
     )
   elif params.security_enabled:
     # Something weird is happening

http://git-wip-us.apache.org/repos/asf/ambari/blob/e7578856/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-INSTALL/scripts/shared_initialization.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-INSTALL/scripts/shared_initialization.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-INSTALL/scripts/shared_initialization.py
index 5c2e29e..dd2c57e 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-INSTALL/scripts/shared_initialization.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-INSTALL/scripts/shared_initialization.py
@@ -35,12 +35,16 @@ def setup_java():
   if not params.jdk_name:
     return
 
-  Directory(params.artifact_dir,
-      recursive = True,
-  )
-  File(jdk_curl_target,
-       content = DownloadSource(format("{jdk_location}/{jdk_name}")),
-  )
+  environment = {
+    "no_proxy": format("{ambari_server_hostname}")
+  }
+
+  Execute(format("mkdir -p {artifact_dir} ; \
+  curl -kf -x \"\" \
+  --retry 10 {jdk_location}/{jdk_name} -o {jdk_curl_target}"),
+          path = ["/bin","/usr/bin/"],
+          not_if = format("test -e {java_exec}"),
+          environment = environment)
 
   if params.jdk_name.endswith(".bin"):
     chmod_cmd = ("chmod", "+x", jdk_curl_target)

http://git-wip-us.apache.org/repos/asf/ambari/blob/e7578856/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/shared_initialization.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/shared_initialization.py b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/shared_initialization.py
index b6d2ba2..17f68ff 100644
--- a/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/shared_initialization.py
+++ b/ambari-server/src/main/resources/stacks/HDP/2.0.6/hooks/before-START/scripts/shared_initialization.py
@@ -97,16 +97,23 @@ def setup_database():
   Load DB
   """
   import params
-  db_driver_download_url = None
-  
+  db_driver_dload_cmd = ""
+  environment = {
+    "no_proxy": format("{ambari_server_hostname}")
+  }
   if params.server_db_name == 'oracle' and params.oracle_driver_url != "":
-    db_driver_download_url = params.oracle_driver_symlink_url
+    db_driver_dload_cmd = format(
+      "curl -kf -x \"\" \
+      --retry 5 {oracle_driver_symlink_url} -o {hadoop_lib_home}/{db_driver_filename}",)
   elif params.server_db_name == 'mysql' and params.mysql_driver_url != "":
-    db_driver_download_url = params.mysql_driver_symlink_url
-
-  if db_driver_download_url:
-    File(format("{hadoop_lib_home}/{db_driver_filename}"),
-         content = DownloadSource(db_driver_download_url),
+    db_driver_dload_cmd = format(
+      "curl -kf -x \"\" \
+      --retry 5 {mysql_driver_symlink_url} -o {hadoop_lib_home}/{db_driver_filename}")
+
+  if db_driver_dload_cmd:
+    Execute(db_driver_dload_cmd,
+            not_if =format("test -e {hadoop_lib_home}/{db_driver_filename}"),
+            environment = environment
     )
 
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/e7578856/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_client.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_client.py b/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_client.py
index ef289d7..3c3bf7e 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_client.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_client.py
@@ -81,8 +81,9 @@ class TestHiveClient(RMFTestCase):
                               owner = 'hive',
                               group = 'hadoop',
                               )
-    self.assertResourceCalled('File', '/usr/lib/ambari-agent/DBConnectionVerification.jar',
-        content = DownloadSource('http://c6401.ambari.apache.org:8080/resources/DBConnectionVerification.jar'),
+    self.assertResourceCalled('Execute', '/bin/sh -c \'cd /usr/lib/ambari-agent/ && curl -kf -x "" --retry 5 http://c6401.ambari.apache.org:8080/resources/DBConnectionVerification.jar -o DBConnectionVerification.jar\'',
+        environment = {'no_proxy': 'c6401.ambari.apache.org'},
+        not_if = '[ -f /usr/lib/ambari-agent/DBConnectionVerification.jar ]',
     )
     self.assertNoMoreResources()
 
@@ -145,7 +146,8 @@ class TestHiveClient(RMFTestCase):
                               owner = 'hive',
                               group = 'hadoop',
                               )
-    self.assertResourceCalled('File', '/usr/lib/ambari-agent/DBConnectionVerification.jar',
-        content = DownloadSource('http://c6401.ambari.apache.org:8080/resources/DBConnectionVerification.jar'),
+    self.assertResourceCalled('Execute', '/bin/sh -c \'cd /usr/lib/ambari-agent/ && curl -kf -x "" --retry 5 http://c6401.ambari.apache.org:8080/resources/DBConnectionVerification.jar -o DBConnectionVerification.jar\'',
+        environment = {'no_proxy': 'c6401.ambari.apache.org'},
+        not_if = '[ -f /usr/lib/ambari-agent/DBConnectionVerification.jar ]',
     )
     self.assertNoMoreResources()

http://git-wip-us.apache.org/repos/asf/ambari/blob/e7578856/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_metastore.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_metastore.py b/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_metastore.py
index ed936d0..ef34cab 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_metastore.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_metastore.py
@@ -203,9 +203,10 @@ class TestHiveMetastore(RMFTestCase):
                               path = ['/bin', '/usr/bin/'],
                               sudo = True,
                               )
-    self.assertResourceCalled('File', '/usr/lib/ambari-agent/DBConnectionVerification.jar',
-        content = DownloadSource('http://c6401.ambari.apache.org:8080/resources/DBConnectionVerification.jar'),
-    )
+    self.assertResourceCalled('Execute', '/bin/sh -c \'cd /usr/lib/ambari-agent/ && curl -kf -x "" --retry 5 http://c6401.ambari.apache.org:8080/resources/DBConnectionVerification.jar -o DBConnectionVerification.jar\'',
+                              environment = {'no_proxy': u'c6401.ambari.apache.org'},
+                              not_if = '[ -f /usr/lib/ambari-agent/DBConnectionVerification.jar ]',
+                              )
     self.assertResourceCalled('File', '/tmp/start_metastore_script',
                               content = StaticFile('startMetastore.sh'),
                               mode = 0755,
@@ -289,9 +290,10 @@ class TestHiveMetastore(RMFTestCase):
                               path = ['/bin', '/usr/bin/'],
                               sudo = True,
                               )
-    self.assertResourceCalled('File', '/usr/lib/ambari-agent/DBConnectionVerification.jar',
-        content = DownloadSource('http://c6401.ambari.apache.org:8080/resources/DBConnectionVerification.jar'),
-    )
+    self.assertResourceCalled('Execute', '/bin/sh -c \'cd /usr/lib/ambari-agent/ && curl -kf -x "" --retry 5 http://c6401.ambari.apache.org:8080/resources/DBConnectionVerification.jar -o DBConnectionVerification.jar\'',
+                              environment = {'no_proxy': u'c6401.ambari.apache.org'},
+                              not_if = '[ -f /usr/lib/ambari-agent/DBConnectionVerification.jar ]',
+                              )
     self.assertResourceCalled('File', '/tmp/start_metastore_script',
                               content = StaticFile('startMetastore.sh'),
                               mode = 0755,

http://git-wip-us.apache.org/repos/asf/ambari/blob/e7578856/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_server.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_server.py b/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_server.py
index 1fc3fbf..e0c683c 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_server.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/HIVE/test_hive_server.py
@@ -323,9 +323,10 @@ class TestHiveServer(RMFTestCase):
                               path = ['/bin', '/usr/bin/'],
                               sudo = True,
                               )
-    self.assertResourceCalled('File', '/usr/lib/ambari-agent/DBConnectionVerification.jar',
-        content = DownloadSource('http://c6401.ambari.apache.org:8080/resources/DBConnectionVerification.jar'),
-    )
+    self.assertResourceCalled('Execute', '/bin/sh -c \'cd /usr/lib/ambari-agent/ && curl -kf -x "" --retry 5 http://c6401.ambari.apache.org:8080/resources/DBConnectionVerification.jar -o DBConnectionVerification.jar\'',
+                              environment = {'no_proxy': u'c6401.ambari.apache.org'},
+                              not_if = '[ -f /usr/lib/ambari-agent/DBConnectionVerification.jar ]',
+                              )
     self.assertResourceCalled('File', '/tmp/start_hiveserver2_script',
                               content = Template('startHiveserver2.sh.j2'),
                               mode = 0755,
@@ -441,9 +442,10 @@ class TestHiveServer(RMFTestCase):
                               path = ['/bin', '/usr/bin/'],
                               sudo = True,
                               )
-    self.assertResourceCalled('File', '/usr/lib/ambari-agent/DBConnectionVerification.jar',
-        content = DownloadSource('http://c6401.ambari.apache.org:8080/resources/DBConnectionVerification.jar'),
-    )
+    self.assertResourceCalled('Execute', '/bin/sh -c \'cd /usr/lib/ambari-agent/ && curl -kf -x "" --retry 5 http://c6401.ambari.apache.org:8080/resources/DBConnectionVerification.jar -o DBConnectionVerification.jar\'',
+                              environment = {'no_proxy': u'c6401.ambari.apache.org'},
+                              not_if = '[ -f /usr/lib/ambari-agent/DBConnectionVerification.jar ]',
+                              )
     self.assertResourceCalled('File', '/tmp/start_hiveserver2_script',
                               content = Template('startHiveserver2.sh.j2'),
                               mode = 0755,

http://git-wip-us.apache.org/repos/asf/ambari/blob/e7578856/ambari-server/src/test/python/stacks/2.0.6/hooks/before-ANY/test_before_any.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/hooks/before-ANY/test_before_any.py b/ambari-server/src/test/python/stacks/2.0.6/hooks/before-ANY/test_before_any.py
index f1cb12e..ca5d789 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/hooks/before-ANY/test_before_any.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/hooks/before-ANY/test_before_any.py
@@ -30,11 +30,11 @@ class TestHookBeforeInstall(RMFTestCase):
                        command="hook",
                        config_file="default.json"
     )
-    self.assertResourceCalled('Directory', '/tmp/AMBARI-artifacts/',
-        recursive = True,
-    )
-    self.assertResourceCalled('File', '/tmp/AMBARI-artifacts//UnlimitedJCEPolicyJDK7.zip',
-        content = DownloadSource('http://c6401.ambari.apache.org:8080/resources//UnlimitedJCEPolicyJDK7.zip'),
+    self.assertResourceCalled('Execute', 'mkdir -p /tmp/AMBARI-artifacts/;     curl -kf -x "" --retry 10     http://c6401.ambari.apache.org:8080/resources//UnlimitedJCEPolicyJDK7.zip -o /tmp/AMBARI-artifacts//UnlimitedJCEPolicyJDK7.zip',
+        environment = {'no_proxy': 'c6401.ambari.apache.org'},
+        not_if = 'test -e /tmp/AMBARI-artifacts//UnlimitedJCEPolicyJDK7.zip',
+        ignore_failures = True,
+        path = ['/bin', '/usr/bin/'],
     )
     self.assertResourceCalled('Group', 'hadoop',
         ignore_failures = False,

http://git-wip-us.apache.org/repos/asf/ambari/blob/e7578856/ambari-server/src/test/python/stacks/2.0.6/hooks/before-INSTALL/test_before_install.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.0.6/hooks/before-INSTALL/test_before_install.py b/ambari-server/src/test/python/stacks/2.0.6/hooks/before-INSTALL/test_before_install.py
index e6db6c7..eeec7ff 100644
--- a/ambari-server/src/test/python/stacks/2.0.6/hooks/before-INSTALL/test_before_install.py
+++ b/ambari-server/src/test/python/stacks/2.0.6/hooks/before-INSTALL/test_before_install.py
@@ -18,9 +18,9 @@ See the License for the specific language governing permissions and
 limitations under the License.
 '''
 
+from stacks.utils.RMFTestCase import *
 from mock.mock import MagicMock, call, patch
 from resource_management import *
-from stacks.utils.RMFTestCase import *
 
 @patch.object(Hook, "run_custom_hook", new = MagicMock())
 class TestHookBeforeInstall(RMFTestCase):
@@ -40,11 +40,10 @@ class TestHookBeforeInstall(RMFTestCase):
     )
     self.assertResourceCalled('Package', 'unzip',)
     self.assertResourceCalled('Package', 'curl',)
-    self.assertResourceCalled('Directory', '/tmp/AMBARI-artifacts/',
-        recursive = True,
-    )
-    self.assertResourceCalled('File', '/tmp/AMBARI-artifacts//jdk-7u67-linux-x64.tar.gz',
-        content = DownloadSource('http://c6401.ambari.apache.org:8080/resources//jdk-7u67-linux-x64.tar.gz'),
+    self.assertResourceCalled('Execute', 'mkdir -p /tmp/AMBARI-artifacts/ ;   curl -kf -x \"\"   --retry 10 http://c6401.ambari.apache.org:8080/resources//jdk-7u67-linux-x64.tar.gz -o /tmp/AMBARI-artifacts//jdk-7u67-linux-x64.tar.gz',
+        not_if = 'test -e /usr/jdk64/jdk1.7.0_45/bin/java',
+        path = ['/bin', '/usr/bin/'],
+        environment = {'no_proxy': 'c6401.ambari.apache.org'},
     )
     self.assertResourceCalled('Directory', '/usr/jdk64',)
     self.assertResourceCalled('Execute', ('chmod', 'a+x', u'/usr/jdk64'),

http://git-wip-us.apache.org/repos/asf/ambari/blob/e7578856/ambari-server/src/test/python/stacks/2.1/HIVE/test_hive_metastore.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/2.1/HIVE/test_hive_metastore.py b/ambari-server/src/test/python/stacks/2.1/HIVE/test_hive_metastore.py
index c545e93..8c9dce8 100644
--- a/ambari-server/src/test/python/stacks/2.1/HIVE/test_hive_metastore.py
+++ b/ambari-server/src/test/python/stacks/2.1/HIVE/test_hive_metastore.py
@@ -193,9 +193,10 @@ class TestHiveMetastore(RMFTestCase):
                               path = ['/bin', '/usr/bin/'],
                               sudo = True,
                               )
-    self.assertResourceCalled('File', '/usr/lib/ambari-agent/DBConnectionVerification.jar',
-        content = DownloadSource('http://c6401.ambari.apache.org:8080/resources/DBConnectionVerification.jar'),
-    )
+    self.assertResourceCalled('Execute', '/bin/sh -c \'cd /usr/lib/ambari-agent/ && curl -kf -x "" --retry 5 http://c6401.ambari.apache.org:8080/resources/DBConnectionVerification.jar -o DBConnectionVerification.jar\'',
+                              environment = {'no_proxy': u'c6401.ambari.apache.org'},
+                              not_if = '[ -f /usr/lib/ambari-agent/DBConnectionVerification.jar ]',
+                              )
     self.assertResourceCalled('File', '/tmp/start_metastore_script',
                               content = StaticFile('startMetastore.sh'),
                               mode = 0755,
@@ -270,9 +271,10 @@ class TestHiveMetastore(RMFTestCase):
                               path = ['/bin', '/usr/bin/'],
                               sudo = True,
                               )
-    self.assertResourceCalled('File', '/usr/lib/ambari-agent/DBConnectionVerification.jar',
-        content = DownloadSource('http://c6401.ambari.apache.org:8080/resources/DBConnectionVerification.jar'),
-    )
+    self.assertResourceCalled('Execute', '/bin/sh -c \'cd /usr/lib/ambari-agent/ && curl -kf -x "" --retry 5 http://c6401.ambari.apache.org:8080/resources/DBConnectionVerification.jar -o DBConnectionVerification.jar\'',
+                              environment = {'no_proxy': u'c6401.ambari.apache.org'},
+                              not_if = '[ -f /usr/lib/ambari-agent/DBConnectionVerification.jar ]',
+                              )
     self.assertResourceCalled('File', '/tmp/start_metastore_script',
                               content = StaticFile('startMetastore.sh'),
                               mode = 0755,

http://git-wip-us.apache.org/repos/asf/ambari/blob/e7578856/ambari-server/src/test/python/stacks/utils/RMFTestCase.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/test/python/stacks/utils/RMFTestCase.py b/ambari-server/src/test/python/stacks/utils/RMFTestCase.py
index 8e02750..5f47a28 100644
--- a/ambari-server/src/test/python/stacks/utils/RMFTestCase.py
+++ b/ambari-server/src/test/python/stacks/utils/RMFTestCase.py
@@ -17,7 +17,7 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 See the License for the specific language governing permissions and
 limitations under the License.
 '''
-__all__ = ["RMFTestCase", "Template", "StaticFile", "InlineTemplate", "DownloadSource", "UnknownConfigurationMock", "FunctionMock",
+__all__ = ["RMFTestCase", "Template", "StaticFile", "InlineTemplate", "UnknownConfigurationMock", "FunctionMock",
            "CallFunctionMock"]
 
 from unittest import TestCase
@@ -244,14 +244,7 @@ def InlineTemplate(name, **kwargs):
   with RMFTestCase.env:
     from resource_management.core.source import InlineTemplate
     return InlineTemplate(name, **kwargs)
-  
-class DownloadSource():
-  def __init__(self, name, **kwargs):
-    self.name = name
-  
-  def __eq__(self, other):
-    from resource_management.core.source import DownloadSource
-    return isinstance(other, DownloadSource) and self.name == other.name
+
 
 class UnknownConfigurationMock():
   def __eq__(self, other):


Mime
View raw message