Exemple #1
0
    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)
Exemple #2
0
    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:
                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)
Exemple #4
0
    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)
Exemple #5
0
 def try_download(download_url):
     tarball = download.download_from_s3(download_url)
     download.extract_archive(tarball, install_dir)
     os.remove(tarball)