Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add wait_for_action and full_pkg_update module #49

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

KinzelL
Copy link

@KinzelL KinzelL commented Jan 14, 2025

This implements the missing wait_for_action feature which is described in that Issue #38.

It also implements a module full_pkg_update that is calling the system.schedulePackageUpdate method of Uyuni API. This will trigger a "Package Install/Upgrade scheduled by user" in Uyuni on a given system. The module will wait for the action to be completed and uses the wait_for_action function. The result will contain the number of installed updates.

I did some basic testing with this playbook:

---
- name: Cool playbook
  hosts: localhost
  gather_facts: false
  tasks:
    - name: Install upgrades
      stdevel.uyuni.full_pkg_update:
        uyuni_host: host
        uyuni_user: user
        uyuni_password: pass
        name: target_host
        uyuni_verify_ssl: false
      register: full_pkg_update

    - debug: var=full_pkg_update

Result:

ok: [localhost] => {
    "full_pkg_update": {
        "changed": true,
        "failed": false,
        "installed_updates": 442
    }
}

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
timedelta is now imported from datetime
the function wait_for_action is used to wait for an action to finish
it requires action_id, system_id, timeout=3600, interval=30 as parameters
This should solve stdevel#38
we changed the name since it was the same thing in our opinion
add full_pkg_update function to uyuni.py
-> does a full package update on system
add get_outdated_pkgs function to uyuni.py
-> checks if there are outdated packages on the system
This function makes sure, the packages are returned in the right way
added the module script for the full package update with ansible
@mat-ti
Copy link
Contributor

mat-ti commented Jan 14, 2025

Uh, this is nice, thank you for your pull request

@stdevel stdevel self-assigned this Jan 29, 2025
@stdevel stdevel added enhancement New feature or request good first issue Good for newcomers labels Jan 29, 2025
@stdevel
Copy link
Owner

stdevel commented Jan 29, 2025

Hi @KinzelL,
thanks for your first contribution! I will check it out and give feedback.

added module to check if managed host needs reboot.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants