def test08_uninstall_rpm_on_segments_and_install(self):
        """
        Try to install a gppkg again, when rpm has not been 
        installed on one of the segments.
        """
        #Use gppkg from previous test
        gppkg_file = self.alpha_spec.get_filename()
        self.install(gppkg_file)

        segment_host_list = get_host_list()[1]
        self.assertTrue(len(segment_host_list) > 0)
        host = segment_host_list[0]

        self.uninstall_rpm_remotely(self.A_spec.get_filename(), host)

        try:
            self.install(gppkg_file)
        except ExecutionError as e:
            #Install the rpm
            with closing(tarfile.open(self.alpha_spec.get_filename())) as tf:
                tf.extract(self.A_spec.get_filename())
            Scp(name="copy rpm to segment",
                srcFile=self.A_spec.get_filename(),
                dstFile=self.A_spec.get_filename(),
                srcHost=None,
                dstHost=host).run(validateAfter=True)
            self.install_rpm_remotely(self.A_spec.get_filename(), host)
            os.remove(self.A_spec.get_filename())
            RemoveRemoteFile(self.A_spec.get_filename(), host).run()
            self.fail("ExecutionError %s" % e)
    def test11_install_rpm_on_segments_and_uninstall(self):
        """
        Try to uninstall a gppkg, when the gppkg has not been installed,
        but the main comprising rpm has been installed on one of the segments.
        The desired result is that the rpm should be uninstalled.
        """
        gppkg_file = self.alpha_spec.get_filename()

        segment_host_list = get_host_list()[1]
        self.assertTrue(len(segment_host_list) > 0)
        host = segment_host_list[0]

        #Install the rpm
        with closing(tarfile.open(self.alpha_spec.get_filename())) as tf:
            tf.extract(self.A_spec.get_filename())
        Scp(name="copy rpm to segment",
            srcFile=self.A_spec.get_filename(),
            dstFile=self.A_spec.get_filename(),
            srcHost=None,
            dstHost=host).run(validateAfter=True)

        self.install_rpm_remotely(self.A_spec.get_filename(), host)

        try:
            self.remove(gppkg_file)
        except ExecutionError as e:
            self.uninstall_rpm_remotely(self.A_spec.get_filename(), host)
            os.remove(self.A_spec.get_filename())
            RemoveRemoteFile(self.A_spec.get_filename(), host).run()
            self.fail("ExecutionError %s" % e)
    def test04_no_package_on_segment(self):
        """
        This test covers the case when there is no
        package installed on one of the segment, but
        it is installed on the master and everywhere else 
        """
        self.install(self.alpha_spec.get_filename())

        segment_host_list = get_host_list()[1]
        self.assertTrue(len(segment_host_list) > 0)
        host = segment_host_list[0]

        RemoveRemoteFile(
            os.path.join(ARCHIVE_PATH, self.alpha_spec.get_filename()),
            host).run()

        self.uninstall_rpm_remotely(self.A_spec.get_filename(), host)

        run_command(self.clean_command)

        self.check_remote_rpm_install(self.A_spec.get_package_name(), host)
        self.assertTrue(
            CheckRemoteFile(
                os.path.join(ARCHIVE_PATH, self.alpha_spec.get_filename()),
                host).run())
Example #4
0
    def test07_no_package_on_standby(self):
        """
        This test covers the case when there is no package
        installed on the standby, but the package is installed
        across the other hosts in the cluster.
        JIRA - MPP-15969
        """ 
        self.install(self.alpha_spec.get_filename())

        standby = get_host_list()[0]
        
        RemoveRemoteFile(os.path.join(ARCHIVE_PATH, self.alpha_spec.get_filename()), standby).run()
        self.uninstall_rpm_remotely(self.A_spec.get_filename(), standby)
        run_command(self.clean_command)
    
        self.check_remote_rpm_install(self.A_spec.get_package_name(), standby)
        self.assertTrue(CheckRemoteFile(os.path.join(ARCHIVE_PATH, self.alpha_spec.get_filename()), standby).run())
Example #5
0
    def test05_delete_package_from_archive_on_standby(self):
        '''
            Known issue: MPP-15737
        '''
        gppkg_file = self.gppkg_spec.get_filename()
        archive_file = os.path.join(ARCHIVE_PATH, gppkg_file)
        self.install(gppkg_file)

        #Remove package from standby
        standby = get_host_list()[0] 
        RemoveRemoteFile(os.path.join(ARCHIVE_PATH, gppkg_file), standby).run()

        try:
            self.install(gppkg_file)
        except ExecutionError, e:
            Scp(name = "copy to segment", srcFile = gppkg_file, dstFile = archive_file, srcHost = None, dstHost = standby).run(validateAfter = True)
            self.fail("ExecutionError %s" % e)
    def test00_delete_package_from_archive_on_standby_and_install(self):
        gppkg_file = self.build(self.alpha_spec, self.A_spec)
        archive_file = os.path.join(ARCHIVE_PATH, gppkg_file)
        self.install(gppkg_file)

        #Remove package from standby
        standby = get_host_list()[0]
        RemoveRemoteFile(os.path.join(ARCHIVE_PATH, gppkg_file), standby).run()

        try:
            self.install(gppkg_file)
        except ExecutionError as e:
            Scp(name="copy gppkg to standby",
                srcFile=gppkg_file,
                dstFile=archive_file,
                srcHost=None,
                dstHost=standby).run(validateAfter=True)
            self.fail("ExecutionError %s" % e)
Example #7
0
    def test04_delete_package_from_archive_on_segment(self):
        '''
            Known issue: MPP-15737
        '''
        gppkg_file = self.gppkg_spec.get_filename()
        archive_file = os.path.join(ARCHIVE_PATH, gppkg_file)
        self.install(gppkg_file)

        # Remove package from archive
        segment_host_list = get_host_list()[1]
        self.assertTrue(len(segment_host_list) > 0)
        RemoveRemoteFile(archive_file, segment_host_list[0])

        try:
            self.install(gppkg_file)
        except ExecutionError as e:
            Scp(name="copy to segment", srcFile=gppkg_file, dstFile=archive_file, srcHost=None,
                dstHost=segment_host_list[0]).run(validateAfter=True)
            self.fail("ExecutionError %s" % e)
    def test07_delete_package_from_archive_on_segment_and_uninstall(self):
        """
        Delete a package from the archive on the segment
        and try to uninstall the gppkg.
        """
        gppkg_file = self.alpha_spec.get_filename()
        archive_file = os.path.join(ARCHIVE_PATH, gppkg_file)
        self.install(gppkg_file)

        #Remove package from archive
        segment_host_list = get_host_list()[1]
        self.assertTrue(len(segment_host_list) > 0)
        host = segment_host_list[0]
        RemoveRemoteFile(archive_file, host).run()

        try:
            self.remove(gppkg_file)
        except ExecutionError as e:
            GpScp(source_path=gppkg_file,
                  target_path=archive_file,
                  host_list=segment_host_list).run()
            self.fail("ExecutionError %s" % str(e))
    def test02_uninstall_rpm_on_standby_and_install(self):
        #Use gppkg from previous test
        gppkg_file = self.alpha_spec.get_filename()
        self.install(gppkg_file)

        standby = get_host_list()[0]

        self.uninstall_rpm_remotely(self.A_spec.get_filename(), standby)
        try:
            self.install(gppkg_file)
        except ExecutionError as e:
            #Install the rpm
            with closing(tarfile.open(self.alpha_spec.get_filename())) as tf:
                tf.extract(self.A_spec.get_filename())
            Scp(name="copy rpm to standby",
                srcFile=self.A_spec.get_filename(),
                dstFile=self.A_spec.get_filename(),
                srcHost=None,
                dstHost=standby).run(validateAfter=True)
            self.install_rpm_remotely(self.A_spec.get_filename(), standby)
            os.remove(self.A_spec.get_filename())
            RemoveRemoteFile(self.A_spec.get_filename(), standby).run()
            self.fail("ExecutionError %s" % e)
    def test01_delete_package_from_archive_on_standby_and_uninstall(self):
        """
            Known issue: MPP-15737
        """
        gppkg_file = self.alpha_spec.get_filename()
        archive_file = os.path.join(ARCHIVE_PATH, gppkg_file)
        self.install(gppkg_file)

        #Remove package from standby
        standby = get_host_list()[0]
        RemoveRemoteFile(os.path.join(ARCHIVE_PATH, gppkg_file), standby).run()

        try:
            self.remove(gppkg_file)
        except ExecutionError as e:
            GpScp(source_path=gppkg_file,
                  target_path=archive_file,
                  host_list=get_host_list()[1]).run()
            Scp(name="copy gppkg to standby",
                srcFile=gppkg_file,
                dstFile=archive_file,
                srcHost=None,
                dstHost=standby).run(validateAfter=True)
            self.fail("ExecutionError %s" % e)
    def test06_delete_package_from_archive_on_segment_and_install(self):
        """
        Delete a package from the archive on the segment 
        and try to install the gppkg again.
        """
        gppkg_file = self.alpha_spec.get_filename()
        archive_file = os.path.join(ARCHIVE_PATH, gppkg_file)
        self.install(gppkg_file)

        #Remove package from archive
        segment_host_list = get_host_list()[1]
        self.assertTrue(len(segment_host_list) > 0)
        host = segment_host_list[0]
        RemoveRemoteFile(archive_file, host).run()

        try:
            self.install(gppkg_file)
        except ExecutionError as e:
            Scp(name="copy gppkg to segment",
                srcFile=gppkg_file,
                dstFile=archive_file,
                srcHost=None,
                dstHost=host).run(validateAfter=True)
            self.fail("ExecutionError %s" % e)
Example #12
0
        operations = []
        gparray = GpArray.initFromCatalog(dbconn.DbURL(port=self.master_port),
                                          utility=True)
        primaries = [
            seg for seg in gparray.getDbList()
            if seg.isSegmentPrimary(current_role=True)
        ]
        for seg in primaries:
            path = os.path.join(
                seg.getSegmentDataDirectory(), DUMP_DIR,
                self.fake_timestamp[0:8], "%s0_%d_%s" %
                (DBDUMP_PREFIX, seg.getSegmentDbId(), self.fake_timestamp))
            if self.compress:
                path += '.gz'
            host = seg.getSegmentHostName()
            operations.append(RemoveRemoteFile(path, host))

        ParallelOperation(operations, self.batch_default).run()
        for operation in operations:
            try:
                operation.get_ret()
            except OSError, e:
                logger.warn('Failed to remove %s on %s' % (path, host))


def BuildRemoteTableDump(restore_tables, real_filename, fake_filename,
                         compress, host):
    return RemoteOperation(
        BuildTableDump(restore_tables, real_filename, fake_filename, compress),
        host)