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

hpilo_boot: fix module failing when trying to power on an already powered-on server #9646

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix: fix hpilo_boot.py module failing when trying to power on an alre…
…ady powered-on server

For this module to be idempotent, it should be successful when trying to reach a power state which is already there.

It was already the case for "poweroff", however when running the module with "boot_once" state, it was failing if the server was already powered_on, which is not an idempotent behavior
ryanb74 authored Jan 28, 2025
commit 02616ec6b3afe92a0aafdc2f9a088725ea1c1e4c
5 changes: 2 additions & 3 deletions plugins/modules/hpilo_boot.py
Original file line number Diff line number Diff line change
@@ -188,9 +188,8 @@ def main():
power_status = ilo.get_host_power_status()

if not force and power_status == 'ON':
module.fail_json(msg='HP iLO (%s) reports that the server is already powered on !' % host)

if power_status == 'ON':
pass
elif power_status == 'ON':
Comment on lines +191 to +192
Copy link
Collaborator

Choose a reason for hiding this comment

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

Hi @ryanb74 Thanks for your contribution!

Please beware this is a breaking change - people might have code out there that expects it to fail. We need to take the long route on this one - add the new behaviour with a feature flag, deprecate the "old" behaviour, and later on remove the "old" behaviour entirely (along with the feature flag).

ilo.warm_boot_server()
# ilo.cold_boot_server()
changed = True