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

fix: fix hpilo_boot.py 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

Conversation

ryanb74
Copy link

@ryanb74 ryanb74 commented Jan 28, 2025

SUMMARY

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

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

hpilo_boot.py

ADDITIONAL INFORMATION

Before change, when running the module with state = "boot_once", the module fails :

Tuesday 28 January 2025  11:08:58 +0100 (0:00:00.012)       0:00:00.344 *******
fatal: [localhost]: FAILED! => {
    "changed": false,
    "msg": "HP iLO (server) reports that the server is already powered on !"
}

PLAY RECAP *******************************************************************************************************************************************************************************************
localhost                  : ok=2    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0  

After change, when running the module with state = "boot_once", the module is successful and doesn't change anything :

Tuesday 28 January 2025  11:11:51 +0100 (0:00:00.012)       0:00:00.326 *******
ok: [localhost] => {
    "changed": false,
    "power": "ON"
}

PLAY RECAP *******************************************************************************************************************************************************************************************
localhost                  : ok=3    changed=0    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

…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
@ansibullbot
Copy link
Collaborator

The test ansible-test sanity --test pep8 [explain] failed with 1 error:

plugins/modules/hpilo_boot.py:191:12: E111: indentation is not a multiple of 4

The test ansible-test sanity --test pep8 [explain] failed with 1 error:

plugins/modules/hpilo_boot.py:191:12: E111: indentation is not a multiple of 4

The test ansible-test sanity --test pep8 [explain] failed with 1 error:

plugins/modules/hpilo_boot.py:191:12: E111: indentation is not a multiple of 4

The test ansible-test sanity --test pep8 [explain] failed with 1 error:

plugins/modules/hpilo_boot.py:191:12: E111: indentation is not a multiple of 4

click here for bot help

@ansibullbot
Copy link
Collaborator

cc @haad
click here for bot help

@ansibullbot ansibullbot added bug This issue/PR relates to a bug ci_verified Push fixes to PR branch to re-run CI module module needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR new_contributor Help guide this first time contributor plugins plugin (any type) labels Jan 28, 2025
Comment on lines +191 to +192
pass
elif power_status == 'ON':
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).

@felixfontein felixfontein added the check-before-release PR will be looked at again shortly before release and merged if possible. label Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue/PR relates to a bug check-before-release PR will be looked at again shortly before release and merged if possible. ci_verified Push fixes to PR branch to re-run CI module module needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR new_contributor Help guide this first time contributor plugins plugin (any type)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants