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: Homebrew module's some functions ignored check_mode option #65387

Merged
merged 3 commits into from
Dec 27, 2019

Conversation

pypypyo14
Copy link
Contributor

SUMMARY
ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

Homebrew module

ADDITIONAL INFORMATION
  • I was referring to homebrew_cask module's function "_upgrade_all()".
  • I wanted to include logic to determine if homebrew and packages will be actually updated or none(already newest version), but I couldn't...

test.yml

---
- hosts: localhost
  tasks:
    - name: Update homebrew
      homebrew:
        update_homebrew: yes
      check_mode: true
    - name: Upgrade homebrew
      homebrew:
        upgrade_all: yes
      check_mode: true
$ ansible-playbook -C test.yml -vvv

(snip)
TASK [Update homebrew] *************************************************************************************************************************************
task path: /Users/Saori_/Works/ansible-contribute-test/test.yml:4
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: Saori_
<127.0.0.1> EXEC /bin/sh -c 'echo ~Saori_ && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /Users/Saori_/.ansible/tmp/ansible-tmp-1575112456.500833-201016108334946 `" && echo ansible-tmp-1575112456.500833-201016108334946="` echo /Users/Saori_/.ansible/tmp/ansible-tmp-1575112456.500833-201016108334946 `" ) && sleep 0'
Using module file /Users/Saori_/Works/ansible-contribute-test/library/homebrew.py
<127.0.0.1> PUT /Users/Saori_/.ansible/tmp/ansible-local-84809deq96yg0/tmphlb7kf2t TO /Users/Saori_/.ansible/tmp/ansible-tmp-1575112456.500833-201016108334946/AnsiballZ_homebrew.py
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x /Users/Saori_/.ansible/tmp/ansible-tmp-1575112456.500833-201016108334946/ /Users/Saori_/.ansible/tmp/ansible-tmp-1575112456.500833-201016108334946/AnsiballZ_homebrew.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '/Users/Saori_/.anyenv/envs/pyenv/versions/3.7.3/bin/python3.7 /Users/Saori_/.ansible/tmp/ansible-tmp-1575112456.500833-201016108334946/AnsiballZ_homebrew.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /Users/Saori_/.ansible/tmp/ansible-tmp-1575112456.500833-201016108334946/ > /dev/null 2>&1 && sleep 0'
changed: [localhost] => {
    "changed": true,
    "invocation": {
        "module_args": {
            "install_options": [],
            "name": null,
            "path": "/usr/local/bin",
            "state": "present",
            "update_homebrew": true,
            "upgrade_all": false
        }
    },
    "msg": "Homebrew would be updated."
}

TASK [Upgrade homebrew] ************************************************************************************************************************************
task path: /Users/Saori_/Works/ansible-contribute-test/test.yml:7
<127.0.0.1> ESTABLISH LOCAL CONNECTION FOR USER: Saori_
<127.0.0.1> EXEC /bin/sh -c 'echo ~Saori_ && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /Users/Saori_/.ansible/tmp/ansible-tmp-1575112457.484122-231437873409978 `" && echo ansible-tmp-1575112457.484122-231437873409978="` echo /Users/Saori_/.ansible/tmp/ansible-tmp-1575112457.484122-231437873409978 `" ) && sleep 0'
Using module file /Users/Saori_/Works/ansible-contribute-test/library/homebrew.py
<127.0.0.1> PUT /Users/Saori_/.ansible/tmp/ansible-local-84809deq96yg0/tmp2qwafv9u TO /Users/Saori_/.ansible/tmp/ansible-tmp-1575112457.484122-231437873409978/AnsiballZ_homebrew.py
<127.0.0.1> EXEC /bin/sh -c 'chmod u+x /Users/Saori_/.ansible/tmp/ansible-tmp-1575112457.484122-231437873409978/ /Users/Saori_/.ansible/tmp/ansible-tmp-1575112457.484122-231437873409978/AnsiballZ_homebrew.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c '/Users/Saori_/.anyenv/envs/pyenv/versions/3.7.3/bin/python3.7 /Users/Saori_/.ansible/tmp/ansible-tmp-1575112457.484122-231437873409978/AnsiballZ_homebrew.py && sleep 0'
<127.0.0.1> EXEC /bin/sh -c 'rm -f -r /Users/Saori_/.ansible/tmp/ansible-tmp-1575112457.484122-231437873409978/ > /dev/null 2>&1 && sleep 0'
changed: [localhost] => {
    "changed": true,
    "invocation": {
        "module_args": {
            "install_options": [],
            "name": null,
            "path": "/usr/local/bin",
            "state": "present",
            "update_homebrew": false,
            "upgrade_all": true
        }
    },
    "msg": "Homebrew packages would be upgraded."
}
META: ran handlers
META: ran handlers

@ansibot
Copy link
Contributor

ansibot commented Nov 30, 2019

@ansibot ansibot added affects_2.10 This issue/PR affects Ansible v2.10 bug This issue/PR relates to a bug. community_review In order to be merged, this PR must follow the community review workflow. macos macOS community module This issue/PR relates to a module. needs_ci This PR requires CI testing to be performed. Please close and re-open this PR to trigger CI. needs_triage Needs a first human triage before being processed. new_contributor This PR is the first contribution by a new community member. packaging Packaging category python3 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. and removed needs_ci This PR requires CI testing to be performed. Please close and re-open this PR to trigger CI. 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 Nov 30, 2019
@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 Dec 10, 2019
@pypypyo14
Copy link
Contributor Author

pypypyo14 commented Dec 18, 2019

I updated to remove 'stale_ci' label.
and ping...

Please let me know if there are any tasks to merge.
Thanks,

@ansibot ansibot removed 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 Dec 18, 2019
@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 Dec 26, 2019
@Akasurde Akasurde self-assigned this Dec 26, 2019
@ansibot ansibot removed the needs_triage Needs a first human triage before being processed. label Dec 26, 2019
@Akasurde Akasurde merged commit c35a7b8 into ansible:devel Dec 27, 2019
@Akasurde
Copy link
Member

@pypypyo14 Thanks for the contribution.

@pypypyo14
Copy link
Contributor Author

thank you!

@pypypyo14 pypypyo14 deleted the 65352 branch December 27, 2019 08:47
countless-integers pushed a commit to countless-integers/ansible that referenced this pull request Jan 6, 2020
update_homebrew and upgrade_all now support check_mode

Fixes: ansible#65352
@ansible ansible locked and limited conversation to collaborators Jan 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.10 This issue/PR affects Ansible v2.10 bug This issue/PR relates to a bug. community_review In order to be merged, this PR must follow the community review workflow. macos macOS community module This issue/PR relates to a module. new_contributor This PR is the first contribution by a new community member. packaging Packaging category python3 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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Homebrew module's some functions ignore check_mode option (with Destructive change)
3 participants