Skip to content

Conversation

@wowi42
Copy link
Contributor

@wowi42 wowi42 commented Mar 12, 2025

Introduces a new fact to check if a system requires a reboot across different Unix-like systems:

  • Linux: Checks /var/run/reboot-required files and Alpine Linux kernel comparison
  • FreeBSD: Compares running and installed kernel versions

Supports detection methods for Linux and FreeBSD systems with a flexible shell script approach.

wowi42 added 4 commits March 12, 2025 09:25
Introduces a new fact to check if a system requires a reboot across different Unix-like systems:
- Linux: Checks /var/run/reboot-required files and Alpine Linux kernel comparison
- FreeBSD: Compares running and installed kernel versions

Supports detection methods for Linux and FreeBSD systems with a flexible shell script approach.
Adds comprehensive test cases for the RebootRequired fact across different Unix-like systems:
- Alpine Linux kernel version comparison test
- Linux standard reboot required file test
- FreeBSD kernel version comparison test
- Linux no reboot required scenario test

These test cases validate the detection logic for various system reboot scenarios.
Refactor the release metadata dictionary comprehension to a single line, removing unnecessary line breaks while preserving the original logic of converting OS release info keys to uppercase.
@wowi42 wowi42 changed the title Add RebootRequired fact for detecting system reboot needs [WIP] Add RebootRequired fact for detecting system reboot needs Mar 25, 2025
@wowi42
Copy link
Contributor Author

wowi42 commented Mar 25, 2025

not sure if it is the best way to do it

Copy link
Member

@Fizzadar Fizzadar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there's some extra test args but otherwise this looks good. The script is somewhat hacky but there's no real alternative with the way facts work today.

Copy link
Member

@Fizzadar Fizzadar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two override decorators needed to fix type check, then good to go I think?

@Fizzadar
Copy link
Member

@wowi42 do you mind giving me push access to the branch, I'd like to fix up the styling to get this merged!

@wowi42 wowi42 changed the title [WIP] Add RebootRequired fact for detecting system reboot needs Add RebootRequired fact for detecting system reboot needs Aug 5, 2025
@wowi42
Copy link
Contributor Author

wowi42 commented Aug 5, 2025

@Fizzadar sorry for the delay. You got access to the branch and I did some patch. We are good to go I think.

Copy link
Member

@Fizzadar Fizzadar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome, thank you for adding this @wowi42!

@Fizzadar Fizzadar merged commit 9e1e212 into pyinfra-dev:3.x Aug 28, 2025
52 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants