def _download_jdk(self, jdk_url, dest_file, progress_func = None): jdk_download_fail_msg = " Failed to download JDK: {0}. Please check that the " \ "JDK is available at {1}. Also you may specify JDK file " \ "location in local filesystem using --jdk-location command " \ "line argument.".format("{0}", jdk_url) try: force_download_file(jdk_url, dest_file, progress_func = progress_func) print 'Successfully downloaded JDK distribution to ' + dest_file except FatalException: raise except Exception, e: err = jdk_download_fail_msg.format(str(e)) raise FatalException(1, err)
def _download_jce_policy(jcpol_url, dest_jcpol_file, resources_dir, properties): dest_file = os.path.abspath(os.path.join(resources_dir, dest_jcpol_file)) if not os.path.exists(dest_file): print 'Downloading JCE Policy archive from ' + jcpol_url + ' to ' + dest_file try: force_download_file(jcpol_url, dest_file) print 'Successfully downloaded JCE Policy archive to ' + dest_file except FatalException: raise except Exception, e: err = 'Failed to download JCE Policy archive: ' + str(e) raise FatalException(1, err)
def _download_jce_policy(jcpol_url, dest_jcpol_file, resources_dir, properties): dest_file = os.path.abspath(os.path.join(resources_dir, dest_jcpol_file)) if not os.path.exists(dest_file): if properties[JCE_DOWNLOAD_SUPPORTED_PROPERTY].upper() == "FALSE": print "ERROR: JCE Policy archive is not found in {1}. JCE Policy archive download is not supported in this distribution. " \ "Please download JCE Policy archive ({0}) from Oracle site, place it into {1} and re-run this script.".format(dest_jcpol_file, dest_file) print 'Exiting...' sys.exit(1) print 'Downloading JCE Policy archive from ' + jcpol_url + ' to ' + dest_file try: force_download_file(jcpol_url, dest_file) print 'Successfully downloaded JCE Policy archive to ' + dest_file except FatalException: raise except Exception, e: err = 'Failed to download JCE Policy archive: ' + str(e) raise FatalException(1, err)
def _download_file(url, destFilePath, progress_function=None, ret=None): ret = _ret_init(ret) if os.path.exists(destFilePath): _ret_append_stdout( ret, "\nFile {0} already exists, assuming it was downloaded before". format(destFilePath)) else: try: #Intrinsically reliable and resumable. Downloads to a temp file and renames the tem file to the destination file # upon successful termination. force_download_file(url, destFilePath, 16 * 1024, progress_function) except FatalException, e: _ret_merge( ret, e.code, None, "Failed to download {0} -> {1} : {2}".format( url, destFilePath, e.reason)) except urllib2.URLError, ue: _ret_merge( ret, 2, None, "Failed to download {0} -> {1} : {2}".format( url, destFilePath, ue.reason))
def install(self, env): import params if not check_windows_service_exists(service_mapping.oozie_server_win_service_name): self.install_packages(env) force_download_file(os.path.join(params.config['hostLevelParams']['jdk_location'], "sqljdbc4.jar"), os.path.join(params.oozie_root, "extra_libs", "sqljdbc4.jar") ) webapps_sqljdbc_path = os.path.join(params.oozie_home, "oozie-server", "webapps", "oozie", "WEB-INF", "lib", "sqljdbc4.jar") if os.path.isfile(webapps_sqljdbc_path): force_download_file(os.path.join(params.config['hostLevelParams']['jdk_location'], "sqljdbc4.jar"), webapps_sqljdbc_path ) force_download_file(os.path.join(params.config['hostLevelParams']['jdk_location'], "sqljdbc4.jar"), os.path.join(params.oozie_home, "share", "lib", "oozie", "sqljdbc4.jar") ) force_download_file(os.path.join(params.config['hostLevelParams']['jdk_location'], "sqljdbc4.jar"), os.path.join(params.oozie_home, "temp", "WEB-INF", "lib", "sqljdbc4.jar") )