def test_install_on_wrong_os_offline_installer(self): image = 'ubuntu' tag = '14.04' host = image + '-master' ubuntu_container = DockerCluster(host, [], DEFAULT_LOCAL_MOUNT_POINT, DEFAULT_DOCKER_MOUNT_POINT) try: ubuntu_container.fetch_image_if_not_present(image, tag) ubuntu_container.start_containers( image + ':' + tag, cmd='tail -f /var/log/bootstrap.log') self.retry(lambda: ubuntu_container.run_script_on_host( install_py26_script, ubuntu_container.master)) ubuntu_container.exec_cmd_on_host( ubuntu_container.master, 'sudo apt-get -y install wget') self.assertRaisesRegexp( OSError, r'ERROR\n' r'Paramiko could not be imported. This usually means that', self.pa_installer.install, cluster=ubuntu_container ) finally: ubuntu_container.tear_down()
def setup_cluster(self, cluster_type): try: installers = self._cluster_types[cluster_type] except KeyError: self.fail( '%s is not a valid cluster type. Valid cluster types are %s' % (cluster_type, ', '.join(self._cluster_types.keys()))) config_filename = ConfigurableCluster.check_for_cluster_config() if config_filename: self.cluster = ConfigurableCluster.start_bare_cluster( config_filename, self, StandalonePrestoInstaller.assert_installed) else: try: self.cluster = DockerCluster.start_existing_images( cluster_type) if self.cluster: self._apply_post_install_hooks(installers) return self.cluster = DockerCluster.start_bare_cluster() except DockerClusterException as e: self.fail(e.msg) self._run_installers(installers) if isinstance(self.cluster, DockerCluster): self.cluster.commit_images(cluster_type)
def setup_cluster(self, cluster_type='base'): cluster_types = ['presto', 'base'] config_filename = ConfigurableCluster.check_for_cluster_config() try: if cluster_type == 'presto': if config_filename: self.cluster = ConfigurableCluster.start_presto_cluster( config_filename, self.install_default_presto, self.assert_installed ) else: self.cluster = DockerCluster.start_presto_cluster( self.install_default_presto) elif cluster_type == 'base': if config_filename: self.cluster = ConfigurableCluster.start_base_cluster( config_filename, self.assert_installed ) else: self.cluster = DockerCluster.start_base_cluster() else: self.fail('{0} is not a supported cluster type. Must choose ' 'one from {1}'.format(cluster_type, cluster_types)) except DockerClusterException as e: self.fail(e.msg)
def setup_cluster(self, bare_image_provider, cluster_type): try: installers = self._cluster_types[cluster_type] except KeyError: self.fail( '%s is not a valid cluster type. Valid cluster types are %s' % (cluster_type, ', '.join(self._cluster_types.keys()))) config_filename = ConfigurableCluster.check_for_cluster_config() if config_filename: self.cluster = ConfigurableCluster.start_bare_cluster( config_filename, self, StandalonePrestoInstaller.assert_installed) else: try: self.cluster = DockerCluster.start_existing_images( bare_image_provider, cluster_type) if self.cluster: self._apply_post_install_hooks(installers) self._update_replacement_keywords(installers) return self.cluster = DockerCluster.start_bare_cluster( bare_image_provider) except DockerClusterException as e: self.fail(e.msg) self._run_installers(installers) if isinstance(self.cluster, DockerCluster): self.cluster.commit_images(bare_image_provider, cluster_type)
def __create_and_start_single_centos_container(self): centos_container = DockerCluster( 'master', [], DEFAULT_LOCAL_MOUNT_POINT, DEFAULT_DOCKER_MOUNT_POINT) # we can't assume that another test has created the image centos_container.create_image( os.path.join(LOCAL_RESOURCES_DIR, 'centos6-ssh-test'), 'teradatalabs/centos6-ssh-test', 'jdeathe/centos-ssh' ) centos_container.start_containers( 'teradatalabs/centos6-ssh-test', cap_add=['NET_ADMIN'] ) return centos_container
def __create_and_start_single_centos_container(self): centos_container = DockerCluster( 'master', [], DEFAULT_LOCAL_MOUNT_POINT, DEFAULT_DOCKER_MOUNT_POINT) # we can't assume that another test has created the image centos_container.create_image( BASE_TD_DOCKERFILE_DIR, BASE_TD_IMAGE_NAME, BASE_IMAGE_NAME ) centos_container.start_containers( BASE_TD_IMAGE_NAME, cap_add=['NET_ADMIN'] ) return centos_container
def setup_cluster(self, bare_image_provider, cluster_type): installers = cluster_types[cluster_type] config_filename = ConfigurableCluster.check_for_cluster_config() if config_filename: self.cluster = ConfigurableCluster.start_bare_cluster( config_filename, self, StandalonePrestoInstaller.assert_installed) self.cluster.ensure_correct_execution_environment() BaseProductTestCase.run_installers(self.cluster, installers, self) else: self.cluster, bare_cluster = DockerCluster.start_cluster( bare_image_provider, cluster_type) self.cluster.ensure_correct_execution_environment() # If we've found images and started a non-bare cluster, the # containers have already had the installers applied to them. # We do need to get the test environment in sync with the # containers by calling the following two functions. # # We do this to save the cost of running the installers on the # docker containers every time we run a test. In practice, # that turns out to be a fairly expensive thing to do. if not bare_cluster: self._apply_post_install_hooks(installers) self._update_replacement_keywords(installers) else: raise RuntimeError("Docker images have not been created")
def setup_cluster(self, bare_image_provider, cluster_type): installers = cluster_types[cluster_type] config_filename = ConfigurableCluster.check_for_cluster_config() if config_filename: self.cluster = ConfigurableCluster.start_bare_cluster( config_filename, self, StandalonePrestoInstaller.assert_installed) else: self.cluster, bare_cluster = DockerCluster.start_cluster( bare_image_provider, cluster_type) # If we've found images and started a non-bare cluster, the # containers have already had the installers applied to them. # We do need to get the test environment in sync with the # containers by calling the following two functions. # # We do this to save the cost of running the installers on the # docker containers every time we run a test. In practice, # that turns out to be a fairly expensive thing to do. if not bare_cluster: self._apply_post_install_hooks(installers) self._update_replacement_keywords(installers) else: raise RuntimeError("Docker images have not been created")
def __create_and_start_single_centos_container(self): cluster_type = 'installer_tester' bare_image_provider = NoHadoopBareImageProvider(BASE_IMAGES_TAG) centos_container, bare_cluster = DockerCluster.start_cluster( bare_image_provider, cluster_type, 'master', [], cap_add=['NET_ADMIN']) if bare_cluster: centos_container.commit_images(bare_image_provider, cluster_type) return centos_container
def setup_docker_cluster(self, cluster_type="centos"): cluster_types = ["presto", "centos"] if cluster_type not in cluster_types: self.fail( "{0} is not a supported cluster type. Must choose one" " from {1}".format(cluster_type, cluster_types) ) try: are_presto_images_present = DockerCluster.check_for_presto_images() if cluster_type == "presto" and are_presto_images_present: self.docker_cluster = DockerCluster.start_presto_cluster() return self.docker_cluster = DockerCluster.start_centos_cluster() if cluster_type == "presto" and not are_presto_images_present: self.install_presto_admin(self.docker_cluster) self.upload_topology() self.server_install() self.docker_client.commit(self.docker_cluster.master, INSTALLED_PRESTO_TEST_MASTER_IMAGE) self.docker_client.commit(self.docker_cluster.slaves[0], INSTALLED_PRESTO_TEST_SLAVE_IMAGE) except DockerClusterException as e: self.fail(e.msg)
def __create_and_start_single_centos_container(self, build_or_runtime): cluster_type = 'installer_tester' bare_image_provider = NoHadoopBareImageProvider(build_or_runtime) centos_container, bare_cluster = DockerCluster.start_cluster( bare_image_provider, cluster_type, 'master', [], cap_add=['NET_ADMIN']) if bare_cluster: centos_container.commit_images(bare_image_provider, cluster_type) return centos_container
def __create_and_start_single_centos_container(self): centos_container = DockerCluster('master', [], DEFAULT_LOCAL_MOUNT_POINT, DEFAULT_DOCKER_MOUNT_POINT) # we can't assume that another test has created the image centos_container.create_image(BASE_TD_DOCKERFILE_DIR, BASE_TD_IMAGE_NAME, BASE_IMAGE_NAME) centos_container.start_containers(BASE_TD_IMAGE_NAME, cap_add=['NET_ADMIN']) return centos_container
def _setup_image(self, bare_image_provider, cluster_type): installers = cluster_types[cluster_type] self.testcase.cluster, bare_cluster = DockerCluster.start_cluster( bare_image_provider, cluster_type) # If we got a bare cluster back, we need to run the installers on it. # applying the post-install hooks and updating the replacement # keywords is handled internally in _run_installers. # # If we got a non-bare cluster back, that means the image already exists # and we created the cluster using that image. if bare_cluster: BaseProductTestCase.run_installers(self.testcase.cluster, installers, self.testcase) if isinstance(self.testcase.cluster, DockerCluster): self.testcase.cluster.commit_images(bare_image_provider, cluster_type) self.testcase.cluster.tear_down()
def _setup_image(self, bare_image_provider, cluster_type): installers = cluster_types[cluster_type] self.testcase.cluster, bare_cluster = DockerCluster.start_cluster( bare_image_provider, cluster_type) # If we got a bare cluster back, we need to run the installers on it. # applying the post-install hooks and updating the replacement # keywords is handled internally in _run_installers. # # If we got a non-bare cluster back, that means the image already exists # and we created the cluster using that image. if bare_cluster: self._run_installers(installers) if isinstance(self.testcase.cluster, DockerCluster): self.testcase.cluster.commit_images(bare_image_provider, cluster_type) self.testcase.cluster.tear_down()
def test_install_on_wrong_os_offline_installer(self): image = 'teradatalabs/ubuntu-trusty-python2.6' tag = BASE_IMAGES_TAG host = 'wrong-os-master' ubuntu_container = DockerCluster(host, [], DEFAULT_LOCAL_MOUNT_POINT, DEFAULT_DOCKER_MOUNT_POINT) if not DockerCluster._check_for_images(image, image, tag): raise RuntimeError("Docker images have not been created") try: ubuntu_container.start_containers( image + ':' + tag, cmd='tail -f /var/log/bootstrap.log') self.assertRaisesRegexp( OSError, r'ERROR\n' r'Paramiko could not be imported. This usually means that', self.pa_installer.install, cluster=ubuntu_container) finally: ubuntu_container.tear_down()
def test_install_on_wrong_os_offline_installer(self): image = 'teradatalabs/ubuntu-trusty-python2.6' tag = BASE_IMAGES_TAG host = 'wrong-os-master' ubuntu_container = DockerCluster(host, [], DEFAULT_LOCAL_MOUNT_POINT, DEFAULT_DOCKER_MOUNT_POINT) if not DockerCluster._check_for_images(image, image, tag): raise RuntimeError("Docker images have not been created") try: ubuntu_container.start_containers( image + ':' + tag, cmd='tail -f /var/log/bootstrap.log') self.assertRaisesRegexp( OSError, r'ERROR\n' r'Paramiko could not be imported. This usually means that', self.pa_installer.install, cluster=ubuntu_container ) finally: ubuntu_container.tear_down()
def test_install_on_wrong_os_offline_installer(self): image = "ubuntu" tag = "14.04" host = image + "-master" ubuntu_container = DockerCluster(host, [], DEFAULT_LOCAL_MOUNT_POINT, DEFAULT_DOCKER_MOUNT_POINT) try: ubuntu_container.fetch_image_if_not_present(image, tag) ubuntu_container.start_containers(image + ":" + tag, cmd="tail -f /var/log/bootstrap.log") ubuntu_container.run_script_on_host(install_py26_script, ubuntu_container.master) ubuntu_container.exec_cmd_on_host(ubuntu_container.master, "sudo apt-get -y install wget") self.assertRaisesRegexp( OSError, r"ERROR\n" r"Paramiko could not be imported. This usually means that", self.pa_installer.install, cluster=ubuntu_container, ) finally: ubuntu_container.tear_down()
def build_installer_in_docker(self, online_installer=False, cluster=None, unique=False): if not cluster: cluster = self.cluster container_name = 'installer' installer_container = DockerCluster( container_name, [], DEFAULT_LOCAL_MOUNT_POINT, DEFAULT_DOCKER_MOUNT_POINT) try: installer_container.clean_up_presto_test_images() installer_container.create_image( os.path.join(LOCAL_RESOURCES_DIR, 'centos6-ssh-test'), 'teradatalabs/centos6-ssh-test', 'jdeathe/centos-ssh' ) installer_container.start_containers( 'teradatalabs/centos6-ssh-test' ) except DockerClusterException as e: installer_container.tear_down() self.fail(e.msg) try: shutil.copytree( prestoadmin.main_dir, os.path.join( installer_container.get_local_mount_dir(container_name), 'presto-admin'), ignore=shutil.ignore_patterns('tmp', '.git', 'presto*.rpm') ) installer_container.run_script_on_host( '-e\n' 'pip install --upgrade pip\n' 'pip install --upgrade wheel\n' 'pip install --upgrade setuptools\n' 'mv %s/presto-admin ~/\n' 'cd ~/presto-admin\n' 'make %s\n' 'cp dist/prestoadmin-*.tar.bz2 %s' % (installer_container.mount_dir, 'dist' if not online_installer else 'dist-online', installer_container.mount_dir), container_name) try: os.makedirs(cluster.get_dist_dir(unique)) except OSError, e: if e.errno != errno.EEXIST: raise local_container_dist_dir = os.path.join( prestoadmin.main_dir, installer_container.get_local_mount_dir(container_name) ) installer_file = fnmatch.filter( os.listdir(local_container_dist_dir), 'prestoadmin-*.tar.bz2')[0] shutil.copy( os.path.join(local_container_dist_dir, installer_file), cluster.get_dist_dir(unique))
def _build_installer_in_docker(self, cluster, online_installer=None, unique=False): if online_installer is None: pa_test_online_installer = os.environ.get( 'PA_TEST_ONLINE_INSTALLER') online_installer = pa_test_online_installer is not None if isinstance(cluster, ConfigurableCluster): online_installer = True container_name = 'installer' cluster_type = 'installer_builder' bare_image_provider = NoHadoopBareImageProvider("build") installer_container, created_bare = DockerCluster.start_cluster( bare_image_provider, cluster_type, 'installer', []) if created_bare: installer_container.commit_images(bare_image_provider, cluster_type) try: shutil.copytree( prestoadmin.main_dir, os.path.join( installer_container.get_local_mount_dir(container_name), 'presto-admin'), ignore=shutil.ignore_patterns('tmp', '.git', 'presto*.rpm')) # Pin pip to 7.1.2 because 8.0.0 removed support for distutils # installed projects, of which the system setuptools is one on our # Docker image. pip 8.0.1 or 8.0.2 replaced the error with a # deprecation warning, and also warns that Python 2.6 is # deprecated. While we still need to support Python 2.6, we'll pin # pip to a 7.x version, but we should revisit this once we no # longer need to support 2.6: # https://github.com/pypa/pip/issues/3384 installer_container.run_script_on_host( 'set -e\n' # use explicit versions of dependent packages 'pip install --upgrade pycparser==2.18 cffi==1.11.5\n' 'pip install --upgrade pycparser==2.18 PyNaCl==1.2.1\n' 'pip install --upgrade pycparser==2.18 idna==2.1 cryptography==2.1.1\n' 'pip install --upgrade pip==9.0.2\n' 'pip install --upgrade wheel==0.23.0\n' 'pip install --upgrade setuptools==20.1.1\n' 'mv %s/presto-admin ~/\n' 'cd ~/presto-admin\n' 'make %s\n' 'cp dist/prestoadmin-*.tar.gz %s' % (installer_container.mount_dir, 'dist' if online_installer else 'dist-offline', installer_container.mount_dir), container_name) try: os.makedirs(cluster.get_dist_dir(unique)) except OSError, e: if e.errno != errno.EEXIST: raise local_container_dist_dir = os.path.join( prestoadmin.main_dir, installer_container.get_local_mount_dir(container_name)) installer_file = fnmatch.filter( os.listdir(local_container_dist_dir), 'prestoadmin-*.tar.gz')[0] shutil.copy(os.path.join(local_container_dist_dir, installer_file), cluster.get_dist_dir(unique))
def build_installer_in_docker(self, online_installer=False, cluster=None, unique=False): if not cluster: cluster = self.docker_cluster container_name = "installer" installer_container = DockerCluster(container_name, [], DEFAULT_LOCAL_MOUNT_POINT, DEFAULT_DOCKER_MOUNT_POINT) try: installer_container.create_image( os.path.join(LOCAL_RESOURCES_DIR, "centos6-ssh-test"), "teradatalabs/centos6-ssh-test", "jdeathe/centos-ssh", ) installer_container.start_containers("teradatalabs/centos6-ssh-test") except DockerClusterException as e: installer_container.tear_down_containers() self.fail(e.msg) try: shutil.copytree( prestoadmin.main_dir, os.path.join(installer_container.get_local_mount_dir(container_name), "presto-admin"), ignore=shutil.ignore_patterns("tmp", ".git", "presto*.rpm"), ) installer_container.run_script( "-e\n" "pip install --upgrade pip\n" "pip install --upgrade wheel\n" "pip install --upgrade setuptools\n" "mv %s/presto-admin ~/\n" "cd ~/presto-admin\n" "make %s\n" "cp dist/prestoadmin-*.tar.bz2 %s" % ( installer_container.docker_mount_dir, "dist" if not online_installer else "dist-online", installer_container.docker_mount_dir, ), container_name, ) try: os.makedirs(cluster.get_dist_dir(unique)) except OSError, e: if e.errno != errno.EEXIST: raise local_container_dist_dir = os.path.join( prestoadmin.main_dir, installer_container.get_local_mount_dir(container_name) ) installer_file = fnmatch.filter(os.listdir(local_container_dist_dir), "prestoadmin-*.tar.bz2")[0] shutil.copy(os.path.join(local_container_dist_dir, installer_file), cluster.get_dist_dir(unique))
def _build_installer_in_docker(self, cluster, online_installer=None, unique=False): if online_installer is None: pa_test_online_installer = os.environ.get('PA_TEST_ONLINE_INSTALLER') online_installer = pa_test_online_installer is not None if isinstance(cluster, ConfigurableCluster): online_installer = True container_name = 'installer' cluster_type = 'installer_builder' bare_image_provider = NoHadoopBareImageProvider(BASE_IMAGES_TAG) installer_container, created_bare = DockerCluster.start_cluster( bare_image_provider, cluster_type, 'installer', []) if created_bare: installer_container.commit_images( bare_image_provider, cluster_type) try: shutil.copytree( prestoadmin.main_dir, os.path.join( installer_container.get_local_mount_dir(container_name), 'presto-admin'), ignore=shutil.ignore_patterns('tmp', '.git', 'presto*.rpm') ) # Pin pip to 7.1.2 because 8.0.0 removed support for distutils # installed projects, of which the system setuptools is one on our # Docker image. pip 8.0.1 or 8.0.2 replaced the error with a # deprecation warning, and also warns that Python 2.6 is # deprecated. While we still need to support Python 2.6, we'll pin # pip to a 7.x version, but we should revisit this once we no # longer need to support 2.6: # https://github.com/pypa/pip/issues/3384 installer_container.run_script_on_host( 'set -e\n' 'pip install --upgrade pip==7.1.2\n' 'pip install --upgrade wheel==0.23.0\n' 'pip install --upgrade setuptools==20.1.1\n' 'mv %s/presto-admin ~/\n' 'cd ~/presto-admin\n' 'make %s\n' 'cp dist/prestoadmin-*.tar.bz2 %s' % (installer_container.mount_dir, 'dist' if online_installer else 'dist-offline', installer_container.mount_dir), container_name) try: os.makedirs(cluster.get_dist_dir(unique)) except OSError, e: if e.errno != errno.EEXIST: raise local_container_dist_dir = os.path.join( prestoadmin.main_dir, installer_container.get_local_mount_dir(container_name) ) installer_file = fnmatch.filter( os.listdir(local_container_dist_dir), 'prestoadmin-*.tar.bz2')[0] shutil.copy( os.path.join(local_container_dist_dir, installer_file), cluster.get_dist_dir(unique))
def _build_installer_in_docker(self, cluster, online_installer=False, unique=False): container_name = 'installer' installer_container = DockerCluster(container_name, [], DEFAULT_LOCAL_MOUNT_POINT, DEFAULT_DOCKER_MOUNT_POINT) try: installer_container.create_image(BASE_TD_DOCKERFILE_DIR, BASE_TD_IMAGE_NAME, BASE_IMAGE_NAME) installer_container.start_containers(BASE_TD_IMAGE_NAME) except DockerClusterException as e: installer_container.tear_down() self.testcase.fail(e.msg) try: shutil.copytree( prestoadmin.main_dir, os.path.join( installer_container.get_local_mount_dir(container_name), 'presto-admin'), ignore=shutil.ignore_patterns('tmp', '.git', 'presto*.rpm')) # Pin pip to 7.1.2 because 8.0.0 removed support for distutils # installed projects, of which the system setuptools is one on our # Docker image. pip 8.0.1 or 8.0.2 replaced the error with a # deprecation warning, and also warns that Python 2.6 is # deprecated. While we still need to support Python 2.6, we'll pin # pip to a 7.x version, but we should revisit this once we no # longer need to support 2.6: # https://github.com/pypa/pip/issues/3384 installer_container.run_script_on_host( 'set -e\n' 'pip install --upgrade pip==7.1.2\n' 'pip install --upgrade wheel==0.23.0\n' 'pip install --upgrade setuptools==20.1.1\n' 'mv %s/presto-admin ~/\n' 'cd ~/presto-admin\n' 'make %s\n' 'cp dist/prestoadmin-*.tar.bz2 %s' % (installer_container.mount_dir, 'dist' if online_installer else 'dist-offline', installer_container.mount_dir), container_name) try: os.makedirs(cluster.get_dist_dir(unique)) except OSError, e: if e.errno != errno.EEXIST: raise local_container_dist_dir = os.path.join( prestoadmin.main_dir, installer_container.get_local_mount_dir(container_name)) installer_file = fnmatch.filter( os.listdir(local_container_dist_dir), 'prestoadmin-*.tar.bz2')[0] shutil.copy(os.path.join(local_container_dist_dir, installer_file), cluster.get_dist_dir(unique))
def _build_installer_in_docker(self, cluster, online_installer=False, unique=False): container_name = 'installer' installer_container = DockerCluster( container_name, [], DEFAULT_LOCAL_MOUNT_POINT, DEFAULT_DOCKER_MOUNT_POINT) try: installer_container.create_image( BASE_TD_DOCKERFILE_DIR, BASE_TD_IMAGE_NAME, BASE_IMAGE_NAME ) installer_container.start_containers( BASE_TD_IMAGE_NAME ) except DockerClusterException as e: installer_container.tear_down() self.testcase.fail(e.msg) try: shutil.copytree( prestoadmin.main_dir, os.path.join( installer_container.get_local_mount_dir(container_name), 'presto-admin'), ignore=shutil.ignore_patterns('tmp', '.git', 'presto*.rpm') ) installer_container.run_script_on_host( '-e\n' 'pip install --upgrade pip\n' 'pip install --upgrade wheel\n' 'pip install --upgrade setuptools\n' 'mv %s/presto-admin ~/\n' 'cd ~/presto-admin\n' 'make %s\n' 'cp dist/prestoadmin-*.tar.bz2 %s' % (installer_container.mount_dir, 'dist' if not online_installer else 'dist-online', installer_container.mount_dir), container_name) try: os.makedirs(cluster.get_dist_dir(unique)) except OSError, e: if e.errno != errno.EEXIST: raise local_container_dist_dir = os.path.join( prestoadmin.main_dir, installer_container.get_local_mount_dir(container_name) ) installer_file = fnmatch.filter( os.listdir(local_container_dist_dir), 'prestoadmin-*.tar.bz2')[0] shutil.copy( os.path.join(local_container_dist_dir, installer_file), cluster.get_dist_dir(unique))
def test_install_on_wrong_os_offline_installer(self): image = 'ubuntu' tag = '14.04' host = image + '-master' ubuntu_container = DockerCluster(host, [], DEFAULT_LOCAL_MOUNT_POINT, DEFAULT_DOCKER_MOUNT_POINT) try: ubuntu_container.fetch_image_if_not_present(image, tag) ubuntu_container.start_containers( image + ':' + tag, cmd='tail -f /var/log/bootstrap.log') self.retry(lambda: ubuntu_container.run_script_on_host( install_py26_script, ubuntu_container.master)) ubuntu_container.exec_cmd_on_host(ubuntu_container.master, 'sudo apt-get -y install wget') self.assertRaisesRegexp( OSError, r'ERROR\n' r'Paramiko could not be imported. This usually means that', self.pa_installer.install, cluster=ubuntu_container) finally: ubuntu_container.tear_down()
def _build_installer_in_docker(self, cluster, online_installer=None, unique=False): if online_installer is None: paTestOnlineInstaller = os.environ.get('PA_TEST_ONLINE_INSTALLER') online_installer = paTestOnlineInstaller is not None container_name = 'installer' installer_container = DockerCluster( container_name, [], DEFAULT_LOCAL_MOUNT_POINT, DEFAULT_DOCKER_MOUNT_POINT) try: installer_container.create_image( BASE_TD_DOCKERFILE_DIR, BASE_TD_IMAGE_NAME, BASE_IMAGE_NAME ) installer_container.start_containers( BASE_TD_IMAGE_NAME ) except DockerClusterException as e: installer_container.tear_down() self.testcase.fail(e.msg) try: shutil.copytree( prestoadmin.main_dir, os.path.join( installer_container.get_local_mount_dir(container_name), 'presto-admin'), ignore=shutil.ignore_patterns('tmp', '.git', 'presto*.rpm') ) # Pin pip to 7.1.2 because 8.0.0 removed support for distutils # installed projects, of which the system setuptools is one on our # Docker image. pip 8.0.1 or 8.0.2 replaced the error with a # deprecation warning, and also warns that Python 2.6 is # deprecated. While we still need to support Python 2.6, we'll pin # pip to a 7.x version, but we should revisit this once we no # longer need to support 2.6: # https://github.com/pypa/pip/issues/3384 installer_container.run_script_on_host( 'set -e\n' 'pip install --upgrade pip==7.1.2\n' 'pip install --upgrade wheel==0.23.0\n' 'pip install --upgrade setuptools==20.1.1\n' 'mv %s/presto-admin ~/\n' 'cd ~/presto-admin\n' 'make %s\n' 'cp dist/prestoadmin-*.tar.bz2 %s' % (installer_container.mount_dir, 'dist' if online_installer else 'dist-offline', installer_container.mount_dir), container_name) try: os.makedirs(cluster.get_dist_dir(unique)) except OSError, e: if e.errno != errno.EEXIST: raise local_container_dist_dir = os.path.join( prestoadmin.main_dir, installer_container.get_local_mount_dir(container_name) ) installer_file = fnmatch.filter( os.listdir(local_container_dist_dir), 'prestoadmin-*.tar.bz2')[0] shutil.copy( os.path.join(local_container_dist_dir, installer_file), cluster.get_dist_dir(unique))