def setup_mongodb(artifacts_url, binaries_url, symbols_url, python_venv_url, install_dir, bin_suffix=None, link_dir=None, install_dir_list=None): # pylint: disable=too-many-arguments """Download, extract and symlink.""" for url in [artifacts_url, binaries_url, symbols_url, python_venv_url]: if url is not None: def try_download(download_url): tarball = download.download_from_s3(download_url) download.extract_archive(tarball, install_dir) os.remove(tarball) try: try_download(url) except Exception as err: # pylint: disable=broad-except LOGGER.warning("Setting up tarball failed with error, retrying once...", error=err) time.sleep(1) try_download(url) if binaries_url is not None: if not link_dir: raise ValueError("link_dir must be specified if downloading binaries") if not is_windows(): link_dir = download.symlink_version(bin_suffix, install_dir, link_dir) else: LOGGER.info( "Linking to install_dir on Windows; executable have to live in different working" " directories to avoid DLLs for different versions clobbering each other") link_dir = download.symlink_version(bin_suffix, install_dir, None) install_dir_list.append(link_dir)
def setup_mongodb(self, url, version): """Download, extract and symlink.""" archive = download.download_mongodb(url) installed_dir = download.extract_archive(archive, self.install_dir) os.remove(archive) download.symlink_version(version, installed_dir, self.link_dir)
def setup_mongodb(artifacts_url, binaries_url, symbols_url, install_dir, bin_suffix=None, link_dir=None): # pylint: disable=too-many-arguments """Download, extract and symlink.""" for url in [artifacts_url, binaries_url, symbols_url]: if url is not None: def try_download(download_url): tarball = download.download_from_s3(download_url) download.extract_archive(tarball, install_dir) os.remove(tarball) try: try_download(url) except Exception as err: # pylint: disable=broad-except LOGGER.warning("Setting up tarball failed with error, retrying once...", error=err) time.sleep(1) try_download(url) if binaries_url is not None: if not link_dir: raise ValueError("link_dir must be specified if downloading binaries") download.symlink_version(bin_suffix, install_dir, link_dir)
def setup_mongodb(self, artifacts_url, binaries_url, symbols_url, install_dir, bin_suffix): # pylint: disable=too-many-arguments """Download, extract and symlink.""" for url in [artifacts_url, binaries_url, symbols_url]: if url is not None: tarball = download.download_from_s3(url) download.extract_archive(tarball, install_dir) os.remove(tarball) if binaries_url is not None: download.symlink_version(bin_suffix, install_dir, self.link_dir)
def setup_mongodb(artifacts_url, binaries_url, symbols_url, install_dir, bin_suffix=None, link_dir=None): # pylint: disable=too-many-arguments """Download, extract and symlink.""" for url in [artifacts_url, binaries_url, symbols_url]: if url is not None: tarball = download.download_from_s3(url) download.extract_archive(tarball, install_dir) os.remove(tarball) if binaries_url is not None: if not link_dir: raise ValueError( "link_dir must be specified if downloading binaries") download.symlink_version(bin_suffix, install_dir, link_dir)
def execute(self): """Execute setup multiversion mongodb.""" for version in self.versions: LOGGER.info("Setting up version.", version=version) LOGGER.info("Fetching download URL from Evergreen.") try: re.match(r"\d+\.\d+", version).group(0) except AttributeError: LOGGER.error( "Input version is not recognized. Some correct examples: 4.0, 4.0.1, 4.0.0-rc0") exit(1) try: urls = {} if self.use_latest: urls = self.get_latest_urls(version) if not urls: LOGGER.warning("Latest URL is not available or not requested, " "we fallback to getting the URL for the version.") urls = self.get_urls(version) binaries_url = urls.get("Binaries", "") mongodb_archive = download.download_mongodb(binaries_url) installed_dir = download.extract_archive(mongodb_archive, self.install_dir) os.remove(mongodb_archive) download.symlink_version(version, installed_dir, self.link_dir) except (github_conn.GithubConnError, evergreen_conn.EvergreenConnError, download.DownloadError) as ex: LOGGER.error(ex) exit(1) else: LOGGER.info("Setup version completed.", version=version) LOGGER.info("-" * 50)