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
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions changelogs/fragments/9646-hpilo-fix-idempotency.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
minor_changes:
- "hpilo_boot - Fix module failing when trying to power on an already powered-on server (idempotency issue) (https://github.com/ansible-collections/community.general/pull/9646)."
5 changes: 2 additions & 3 deletions plugins/modules/hpilo_boot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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).

Copy link
Author

@ryanb74 ryanb74 Mar 10, 2025

Choose a reason for hiding this comment

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

Hi @russoz, thanks for the review

Sorry for the late answer, I don't have much time to work on this.

I found this markown from one of your repositories, I'll try to fix the code according to it to properly deprecate the old behavior when possible and then update this issue

Copy link
Collaborator

Choose a reason for hiding this comment

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

Please do not yet deprecate the old behavior. First add the new option, the deprecation should add later so users have a chance to adjust before the deprecation warning hits them.

ilo.warm_boot_server()
# ilo.cold_boot_server()
changed = True
Expand Down
Loading