Beispiel #1
0
def user_clients_upgrade(old_repo, clients, agent):
    """Helper function to run upgrade on user provided clients

    :param string old_repo: The old tools repo to disable before updating
        katello-agent package
    :param list clients: The list of clients onto which katello-agent package
        will be updated
    :param string agent: puppet-agent / katello-agent
    """
    for client in clients:
        execute(disable_repos, old_repo, host=client)
        execute(lambda: run(f'yum update -y {agent}'), host=client)
        post = version_filter(execute(lambda: run(f'rpm -q {agent}'), host=client)[client])
        logger.highlight(f'{agent} on {client} upgraded to {post}')
def docker_clients_agent_version(clients, agent):
    """Determines and returns the katello or puppet agent version on docker
    clients

    :param dict clients: The dictionary containing client_name as key and
        container_id as value
    :param string agent: puppet/ puppet-agent / katello-agent
    :returns dict: The dict of docker clients hostname as key and
        its katello or puppet agent version as value
    """
    clients_dict = {}
    for hostname, container in clients.items():
        pst = version_filter(
            docker_execute_command(container, 'rpm -q {}'.format(agent)))
        clients_dict[hostname] = pst
    return clients_dict
Beispiel #3
0
def docker_clients_agent_version(clients, puppet=False):
    """Determines and returns the katello or puppet agent version on docker
    clients

    :param dict clients: The dictionary containing client_name as key and
        container_id as value
    :returns dict: The dict of docker clients hostname as key and
        its katello or puppet agent version as value
    :param bool puppet: get puppet agent version if true
    """
    clients_dict = {}
    agent = 'puppet' if puppet else 'katello'
    for hostname, container in clients.items():
        pst = version_filter(
            docker_execute_command(container, 'rpm -q {}-agent'.format(agent)))
        clients_dict[hostname] = pst
    return clients_dict
Beispiel #4
0
def user_clients_upgrade(old_repo, clients, puppet=False):
    """Helper function to run upgrade on user provided clients

    :param string old_repo: The old tools repo to disable before updating
        katello-agent package
    :param list clients: The list of clients onto which katello-agent package
        will be updated
    :param bool puppet: clients are puppet clients or not, default no
    """
    for client in clients:
        execute(disable_repos, old_repo, host=client)
        agent = 'puppet' if puppet else 'katello'
        execute(lambda: run('yum update -y {}-agent'.format(agent)),
                host=client)
        post = version_filter(
            execute(lambda: run('rpm -q {}-agent'.format(agent)),
                    host=client)[client])
        logger.highlight('{0}-agent on {1} upgraded to {2}'.format(
            agent, client, post))
Beispiel #5
0
def docker_clients_agent_version(clients, agent):
    """Determines and returns the katello or puppet agent version on docker
    clients

    :param dict clients: The dictionary containing client_name as key and
        container_id as value
    :param string agent: puppet/ puppet-agent / katello-agent
    :returns dict: The dict of docker clients hostname as key and
        its katello or puppet agent version as value
    """
    clients_dict = {}
    for hostname, container in tuple(clients.items()):
        try:
            command_output = docker_execute_command(container, f'rpm -q {agent}')
            pst = version_filter(command_output)
            clients_dict[hostname] = pst
        except Exception as ex:
            logger.warn(ex)
            clients_dict[hostname] = f"{agent} package not updated"
    return clients_dict