Пример #1
0
    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))
Пример #2
0
    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))
Пример #3
0
    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))
Пример #4
0
 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 _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(
                "-e\n"
                "pip install --upgrade pip==7.1.2\n"
                "pip install --upgrade wheel==0.23.0\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 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))
Пример #6
0
    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))
Пример #7
0
 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
Пример #8
0
 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