예제 #1
0
    def create_repositories(self, plugins):
        operating_system = self.cluster.release.operating_system

        for plugin in plugins:
            uids = self._get_node_uids_for_plugin_tasks(plugin)

            # If there are no nodes for tasks execution
            # or if there are no files in repository
            if not uids or not plugin.repo_files(self.cluster):
                continue

            if operating_system == consts.RELEASE_OS.centos:
                repo = self.get_centos_repo(plugin)
                yield self.serialize_task(
                    plugin, templates.make_centos_repo_task(uids, repo))

            elif operating_system == consts.RELEASE_OS.ubuntu:
                repo = self.get_ubuntu_repo(plugin)

                yield self.serialize_task(
                    plugin, templates.make_ubuntu_sources_task(uids, repo))

                # do not add preferences task to task list if we can't
                # complete it (e.g. can't retrieve or parse Release file)
                task = templates.make_ubuntu_preferences_task(uids, repo)
                if task is not None:
                    yield self.serialize_task(plugin, task)

                # apt-get update executed after every additional source.list
                # to be able understand what plugin source.list caused error
                yield self.serialize_task(plugin,
                                          templates.make_apt_update_task(uids))
            else:
                raise errors.InvalidOperatingSystem(
                    'Operating system {0} is invalid'.format(operating_system))
예제 #2
0
    def create_repositories(self, plugins):
        operating_system = self.cluster.release.operating_system

        repo_tasks = []
        for plugin in plugins:
            uids = get_uids_for_tasks(self.nodes, plugin.tasks)

            # If there are not nodes for tasks execution
            # or if there are no files in repository
            if not uids or not plugin.repo_files(self.cluster):
                continue

            if operating_system == consts.RELEASE_OS.centos:
                repo_tasks.append(
                    self.serialize_task(
                        plugin, {},
                        templates.make_centos_repo_task(
                            plugin.full_name,
                            plugin.repo_url(self.cluster), uids)))
            elif operating_system == consts.RELEASE_OS.ubuntu:
                repo_tasks.append(
                    self.serialize_task(
                        plugin, {},
                        templates.make_multiversion_ubuntu(
                            plugin.full_name,
                            plugin.repo_url(self.cluster), uids)))
                #apt-get upgrade executed after every additional source.list
                #to be able understand what plugin source.list caused error
                repo_tasks.append(
                    self.serialize_task(
                        plugin, {},
                        templates.make_apt_update_task(uids)))
            else:
                raise errors.InvalidOperatingSystem(
                    'Operating system {0} is invalid'.format(operating_system))

        return repo_tasks