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 a possible issue with comparing values with $null #37763

Merged
merged 1 commit into from Nov 18, 2018

Conversation

dagwieers
Copy link
Contributor

SUMMARY

This PR includes:

  • Fix $null comparison.
  • Simplify Get-AnsibleParam in the same effort
ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

Ansible.ModuleUtils.Legacy.psm1

ANSIBLE VERSION

v2.6

Copy link
Contributor

@jborean93 jborean93 left a comment

Choose a reason for hiding this comment

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

Looks good to me

@ansibot ansibot added bug This issue/PR relates to a bug. needs_triage Needs a first human triage before being processed. support:core This issue/PR relates to code supported by the Ansible Engineering Team. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Mar 21, 2018
@samdoran samdoran removed the needs_triage Needs a first human triage before being processed. label Mar 22, 2018
@dagwieers dagwieers removed the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. label Mar 27, 2018
@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Apr 4, 2018
@ansibot ansibot added the affects_2.6 This issue/PR affects Ansible v2.6 label May 22, 2018
@jborean93
Copy link
Contributor

@dagwieers I can't remember, was this to fix an actual issue or just to work with the pslint rules we had at the time?

@ansibot ansibot added stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. and removed stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. labels May 25, 2018
@dagwieers
Copy link
Contributor Author

@jborean93 This was originally to fix the PSLint rule which we then disabled. But IIRC this was a genuine issue in this specific case as indicated by the comment above the $null comparison.

So we make it very simple, if it is actually $null, we return $null with no special treatment from the very start, easier to read that code IMO.

@ansibot ansibot added the needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. label May 26, 2018
@mattclay
Copy link
Member

CI failure in integration tests: https://app.shippable.com/github/ansible/ansible/runs/71742/18/tests

@mattclay mattclay added the ci_verified Changes made in this PR are causing tests to fail. label Jun 28, 2018
@ansibot
Copy link
Contributor

ansibot commented Jul 6, 2018

@ansibot ansibot added windows Windows community and removed ci_verified Changes made in this PR are causing tests to fail. labels Jul 6, 2018
@dagwieers
Copy link
Contributor Author

@mattclay The CI failures are caused by regressions in Ansible v2.6 (fixed by: #42330).

This PR includes:
- Fix $null comparison.
- Simplify Get-AnsibleParam in the same effort
@dagwieers
Copy link
Contributor Author

@jborean93 The $null -eq $value was in the meantime already fixed, but this still simplifies the logic. So I would prefer if it got merged anyhow.

@ansibot ansibot removed needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. labels Jul 17, 2018
@ansibot ansibot added the stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. label Jul 25, 2018
@ansibot ansibot added support:community This issue/PR relates to code supported by the Ansible community. and removed support:core This issue/PR relates to code supported by the Ansible Engineering Team. labels Sep 19, 2018
@ansibot ansibot added the community_review In order to be merged, this PR must follow the community review workflow. label Oct 24, 2018
@jborean93
Copy link
Contributor

@dagwieers is this actually fixing an issue, I'm reluctant to change Legacy.psm1 unless there is a real reason to.

@dagwieers
Copy link
Contributor Author

Readability, there's no need anymore to check for an array, or that complexity. Check the diff without whitespace-changes and you'll see this is trivial.

@jborean93
Copy link
Contributor

Fair enough, didn't have the whitespace-changes check and it seems trivial now.

@jborean93 jborean93 merged commit 5f6a350 into ansible:devel Nov 18, 2018
mjmayer pushed a commit to mjmayer/ansible that referenced this pull request Nov 30, 2018
This PR includes:
- Fix $null comparison.
- Simplify Get-AnsibleParam in the same effort
Tomorrow9 pushed a commit to Tomorrow9/ansible that referenced this pull request Dec 4, 2018
This PR includes:
- Fix $null comparison.
- Simplify Get-AnsibleParam in the same effort
@ansible ansible locked and limited conversation to collaborators Jul 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.6 This issue/PR affects Ansible v2.6 bug This issue/PR relates to a bug. community_review In order to be merged, this PR must follow the community review workflow. stale_ci This PR has been tested by CI more than one week ago. Close and re-open this PR to get it retested. support:community This issue/PR relates to code supported by the Ansible community. windows Windows community
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants