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

Alternatives module: Add a check that the path to the executable exist #24800

Merged
merged 2 commits into from
Aug 18, 2017

Conversation

khomutoff
Copy link
Contributor

SUMMARY

By default, the alternatives tool does not verify the path to the executable that the link should point to. I've added a check that should prevent installation of requested path if the path does not exist in a system.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

alternatives

ANSIBLE VERSION
ansible 2.2.0.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = Default w/o overrides

@ansibot
Copy link
Contributor

ansibot commented May 19, 2017

@ansibot ansibot added affects_2.4 This issue/PR affects Ansible v2.4 bugfix_pull_request community_review In order to be merged, this PR must follow the community review workflow. module This issue/PR relates to a module. needs_triage Needs a first human triage before being processed. labels May 19, 2017
@nitzmahone nitzmahone removed the needs_triage Needs a first human triage before being processed. label May 19, 2017
@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. support:community This issue/PR relates to code supported by the Ansible community. labels Jun 23, 2017
@pilou-
Copy link
Contributor

pilou- commented Aug 9, 2017

This update seems unnecessary: update-alternatives command already checks that requested path exists and returns an error when requested path doesn't exist.

For example:

$ cat /var/lib/dpkg/alternatives/w
auto
/usr/bin/w
w.1.gz
/usr/share/man/man1/w.1.gz

$ sudo update-alternatives --install /usr/bin/w w /tmp/notexistent 100              
update-alternatives: error: alternative path /tmp/notexistent doesn't exist

@khomutoff
Copy link
Contributor Author

khomutoff commented Aug 9, 2017

@pilou- I've tested on one of our Fedora Linux instances:

$ sudo update-alternatives --install /usr/bin/java open_jdk /tmp/notexistent 2000

$ sudo update-alternatives --display open_jdk
open_jdk - status is auto.
 link currently points to /tmp/notexistent
/tmp/notexistent - priority 2000
Current `best' version is /tmp/notexistent.

$ sudo update-alternatives --version
alternatives version 1.7

$ ls /tmp/notexistent
ls: cannot access /tmp/notexistent: No such file or directory

@pilou-
Copy link
Contributor

pilou- commented Aug 9, 2017

Oops, I only checked on Debian :-/ Then this PR is useful :-) !

@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 Aug 9, 2017
@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 Aug 18, 2017
@calfonso
Copy link
Contributor

rebuild_merge

@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 Aug 18, 2017
@ansibot ansibot merged commit 277b8bf into ansible:devel Aug 18, 2017
pilou- added a commit to pilou-/ansible that referenced this pull request Aug 29, 2017
mattclay pushed a commit that referenced this pull request Sep 14, 2017
prasadkatti pushed a commit to prasadkatti/ansible that referenced this pull request Oct 1, 2017
ansible#24800)

* Add check that the path to the executable exists

* Corrected a typo
prasadkatti pushed a commit to prasadkatti/ansible that referenced this pull request Oct 1, 2017
BondAnthony pushed a commit to BondAnthony/ansible that referenced this pull request Oct 5, 2017
@ansibot ansibot added bug This issue/PR relates to a bug. and removed bugfix_pull_request labels Mar 6, 2018
@ansible ansible locked and limited conversation to collaborators Apr 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.4 This issue/PR affects Ansible v2.4 bug This issue/PR relates to a bug. community_review In order to be merged, this PR must follow the community review workflow. module This issue/PR relates to a module. 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.

None yet

5 participants