コード例 #1
0
def _init_reposync(reposync, label="Label", repo_type=RTYPE, **kwargs):
    """Initialize the RepoSync object with some mocked attrs"""
    reposync.RepoSync.get_compatible_arches = Mock(
        return_value=['arch1', 'arch2'])
    reposync.RepoSync.get_channel_arch = Mock(return_value=['arch1'])
    channel = {'org_id': 1, 'id': 1, 'arch': 'arch1'}
    reposync.RepoSync.load_channel = Mock(return_value=channel)
    rs = reposync.RepoSync(label, repo_type, **kwargs)
    return rs
コード例 #2
0
    def _sync_channel(self, channel):
        excluded_urls = []
        kickstart_trees = []

        if channel in self.kickstart_metadata:
            kickstart_trees = self.kickstart_metadata[channel]
            excluded_urls.extend(self.cdn_repository_manager.excluded_urls)

        if self.no_kickstarts:
            kickstart_repos = self.cdn_repository_manager.get_content_sources_kickstart(
                channel)
            excluded_urls.extend([x['relative_url'] for x in kickstart_repos])

        log(0, "======================================")
        log(0, "| Channel: %s" % channel)
        log(0, "======================================")

        # Print note if channel is already EOL
        if self._is_channel_eol(channel):
            log(
                0, "NOTE: This channel reached end-of-life on %s." %
                datetime.strptime(self.channel_metadata[channel]['eol'],
                                  "%Y-%m-%d %H:%M:%S").strftime("%Y-%m-%d"))

        log(0, "Sync of channel started.")
        log2disk(
            0,
            "Please check 'cdnsync/%s.log' for sync log of this channel." %
            channel,
            notimeYN=True)
        sync = reposync.RepoSync(channel,
                                 repo_type="yum",
                                 url=None,
                                 fail=False,
                                 filters=False,
                                 no_packages=self.no_packages,
                                 no_errata=self.no_errata,
                                 sync_kickstart=(not self.no_kickstarts),
                                 force_all_errata=self.force_all_errata,
                                 force_kickstart=self.force_kickstarts,
                                 latest=False,
                                 metadata_only=self.no_rpms,
                                 excluded_urls=excluded_urls,
                                 strict=self.consider_full,
                                 log_dir="cdnsync",
                                 log_level=self.log_level,
                                 check_ssl_dates=True,
                                 force_null_org_content=True)
        sync.set_ks_tree_type('rhn-managed')
        if self.import_batch_size:
            sync.set_import_batch_size(self.import_batch_size)
        if kickstart_trees:
            # Assuming all trees have same install type
            sync.set_ks_install_type(kickstart_trees[0]['ks_install_type'])
        sync.set_urls_prefix(self.mount_point)
        return sync.sync()
コード例 #3
0
ファイル: cdnsync.py プロジェクト: DeadRabb1t/spacewalk
    def _sync_channel(self, channel):
        excluded_urls = []
        kickstart_trees = []

        if channel in self.kickstart_metadata:
            kickstart_trees = self.kickstart_metadata[channel]

        if self.no_kickstarts:
            kickstart_repos = self.cdn_repository_manager.get_content_sources_kickstart(
                channel)
            excluded_urls.extend([x['relative_url'] for x in kickstart_repos])

        log(0, "======================================")
        log(0, "| Channel: %s" % channel)
        log(0, "======================================")
        log(0, "Sync of channel started.")
        log2disk(
            0,
            "Please check 'cdnsync/%s.log' for sync log of this channel." %
            channel,
            notimeYN=True)
        sync = reposync.RepoSync(channel,
                                 "yum",
                                 url=None,
                                 fail=False,
                                 filters=False,
                                 no_packages=self.no_packages,
                                 no_errata=self.no_errata,
                                 sync_kickstart=(not self.no_kickstarts),
                                 force_all_errata=self.force_all_errata,
                                 force_kickstart=self.force_kickstarts,
                                 latest=False,
                                 metadata_only=self.no_rpms,
                                 excluded_urls=excluded_urls,
                                 strict=self.consider_full,
                                 log_dir="cdnsync",
                                 log_level=self.log_level,
                                 check_ssl_dates=True,
                                 force_null_org_content=True)
        sync.set_ks_tree_type('rhn-managed')
        if kickstart_trees:
            # Assuming all trees have same install type
            sync.set_ks_install_type(kickstart_trees[0]['ks_install_type'])
        sync.set_urls_prefix(self.mount_point)
        return sync.sync()
コード例 #4
0
ファイル: cdnsync.py プロジェクト: borland667/spacewalk
    def _sync_channel(self, channel):
        excluded_urls = []
        kickstart_trees = []

        if channel in self.kickstart_metadata:
            kickstart_trees = self.kickstart_metadata[channel]

        if self.no_kickstarts:
            for tree in kickstart_trees:
                tree_label = tree['ks_tree_label']
                source = self.kickstart_source_mapping[tree_label][0]
                excluded_urls.append(CFG.CDN_ROOT + source['relative_url'])

        log(0, "======================================")
        log(0, "| Channel: %s" % channel)
        log(0, "======================================")
        log(0, "Sync of channel started.")
        log2disk(
            0,
            "Please check 'cdnsync/%s.log' for sync log of this channel." %
            channel,
            notimeYN=True)
        sync = reposync.RepoSync(channel,
                                 "yum",
                                 url=None,
                                 fail=True,
                                 filters=False,
                                 no_packages=self.no_packages,
                                 no_errata=self.no_errata,
                                 sync_kickstart=(not self.no_kickstarts),
                                 latest=False,
                                 metadata_only=self.no_rpms,
                                 excluded_urls=excluded_urls,
                                 strict=1,
                                 log_dir="cdnsync",
                                 log_level=self.log_level)
        sync.set_ks_tree_type('rhn-managed')
        if kickstart_trees:
            # Assuming all trees have same install type
            sync.set_ks_install_type(kickstart_trees[0]['ks_install_type'])
        return sync.sync(update_repodata=True)