예제 #1
0
def produce_messages(tasks):
    # Type casting to list to be Py2&Py3 compatible as on Py3 keys() returns dict_keys(), not a list
    to_install_pkgs = sorted(tasks[Task.INSTALL].keys())
    to_remove_pkgs = sorted(tasks[Task.REMOVE].keys())
    to_enable_repos = sorted(
        set(tasks[Task.INSTALL].values()) | set(tasks[Task.KEEP].values()))

    if to_install_pkgs or to_remove_pkgs:
        enabled_modules = _get_enabled_modules()
        modules_to_enable = [
            Module(name=p[1][0], stream=p[1][1]) for p in to_install_pkgs
            if p[1]
        ]
        modules_to_reset = enabled_modules
        to_install_pkg_names = [p[0] for p in to_install_pkgs]
        to_remove_pkg_names = [p[0] for p in to_remove_pkgs]

        api.produce(
            PESRpmTransactionTasks(to_install=to_install_pkg_names,
                                   to_remove=to_remove_pkg_names,
                                   modules_to_enable=modules_to_enable,
                                   modules_to_reset=modules_to_reset))

    if to_enable_repos:
        api.produce(RepositoriesSetupTasks(to_enable=to_enable_repos))
예제 #2
0
def produce_messages(tasks):
    # Type casting to list to be Py2&Py3 compatible as on Py3 keys() returns dict_keys(), not a list
    to_install_pkgs = sorted(tasks['to_install'].keys())
    to_remove_pkgs = sorted(tasks['to_remove'].keys())
    to_enable_repos = sorted(set(tasks['to_install'].values() + tasks['to_keep'].values()))

    if to_install_pkgs or to_remove_pkgs:
        api.produce(PESRpmTransactionTasks(to_install=to_install_pkgs,
                                           to_remove=to_remove_pkgs))

    if to_enable_repos:
        api.produce(RepositoriesSetupTasks(to_enable=to_enable_repos))
예제 #3
0
def produce_messages(to_install, to_remove):
    to_install_pkgs = set(to_install.keys())
    to_remove_pkgs = set(to_remove.keys())
    to_enable_repos = set(to_install.values())

    if to_install_pkgs or to_remove_pkgs:
        api.produce(
            PESRpmTransactionTasks(to_install=list(to_install_pkgs),
                                   to_remove=list(to_remove_pkgs)))

    if to_enable_repos:
        api.produce(RepositoriesSetupTasks(to_enable=list(to_enable_repos)))