Ejemplo n.º 1
0
def _fix_treeinfo_files(distribution_dir):
    """
    find all treeinfo or .treeinfo files in the distribution directory and
    strip any references to repomd.xml in checksum lists.

    Pulp 2.4 does this stripping when saving new treeinfo files but we need do
    a one-time pass of existing files during the upgrade process.
    """
    for root, dirs, files in os.walk(distribution_dir):
        for fname in files:
            if fname.startswith('treeinfo') or fname.startswith('.treeinfo'):
                treeinfo_file = os.path.join(root, fname)
                _logger.info("stripping repomd.xml checksum from %s" % treeinfo_file)
                treeinfo.strip_treeinfo_repomd(treeinfo_file)
Ejemplo n.º 2
0
def _fix_treeinfo_files(distribution_dir):
    """
    find all treeinfo or .treeinfo files in the distribution directory and
    strip any references to repomd.xml in checksum lists.

    Pulp 2.4 does this stripping when saving new treeinfo files but we need do
    a one-time pass of existing files during the upgrade process.
    """
    for root, dirs, files in os.walk(distribution_dir):
        for fname in files:
            if fname.startswith('treeinfo') or fname.startswith('.treeinfo'):
                treeinfo_file = os.path.join(root, fname)
                _logger.info("stripping repomd.xml checksum from %s" %
                             treeinfo_file)
                treeinfo.strip_treeinfo_repomd(treeinfo_file)
Ejemplo n.º 3
0
    def test_treeinfo_altered(self, mock_open):
        mock_file = mock.MagicMock(spec=file)
        mock_file.readlines.return_value = StringIO(self.TREEINFO_WITH_REPOMD).readlines()
        mock_context = mock.MagicMock()
        mock_context.__enter__.return_value = mock_file
        mock_open.return_value = mock_context
        treeinfo.strip_treeinfo_repomd("/mock/treeinfo/path")

        mock_file.writelines.assert_called_once_with(['\n', '[general]\n', 'name = Some-treeinfo\n',
                                                      'family = mockdata\n', '\n', '[stage2]\n',
                                                      'mainimage = LiveOS/squashfs.img\n', '\n',
                                                      '[images-x86_64]\n',
                                                      'kernel = images/pxeboot/vmlinuz\n',
                                                      'initrd = images/pxeboot/initrd.img\n',
                                                      '\n', '[checksums]\n',
                                                      'images/efiboot.img = sha256:12345\n'])