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
Add the ability to specify an install_dir to the gem module #38195
Conversation
The test
The test
|
16ec583
to
1ade944
Compare
I'm bumping this, because I fixed all the unit test, but the integration tests are failing. And I can't understand how this is related to my fix... Are the integration tests flaky, or is it me? |
Looks like the test failures are due to external repositories that are inaccessible. I'll restart the tests. |
It looks like it's working @samdoran . Thanks :) . |
.pytest_cache/v/cache/lastfailed
Outdated
@@ -0,0 +1 @@ | |||
{} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you remove the .pytest_cache
entries from this commit please?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Of course I can.
This is embarrassing. I usually check what I commit, but not this time :( .
@@ -252,6 +272,8 @@ def main(): | |||
module.fail_json(msg="Cannot specify version when state=latest") | |||
if module.params['gem_source'] and module.params['state'] == 'latest': | |||
module.fail_json(msg="Cannot maintain state=latest when installing from local source") | |||
if module.params['user_install'] and module.params['install_dir']: | |||
module.fail_json(msg="install_dir requires user_install=false") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than adding an explicit check, you could just set user_install
and install_dir
as mutually exclusive.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tell me if I'm wrong, but I'm not sure this is possible.
In order for this feature to work, the user MUST specify:
gem:
user_install: no
install_dir: /some/other/directory
The default of user_install
being True
.
Unless I'm mistaking, mutually_exclusive
means that "the user CAN specify
one, but MUST NOT specify the other." However, here, the user MUST specify both.
If I'm right, there are two solutions:
- Keep the current code (= the manual check)
- Change the default of
user_install
tono
, thus loosing backward compatibility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you're correct. After more careful reading, I see what you're trying to accomplish. Changing the default would not be a good idea.
Could you also add tests for |
@samdoran you're right. Good catch. I've made the changes you recommended ;) . ready_for_review |
The test
|
e3c175c
to
6fe61ed
Compare
Thanks @samdoran for adding the tests, and updating the README 👍 . Do you know what are the next steps to get that merge into devel? I'm not to familiar with Ansible's contribution process. |
Merged to |
…38195) * Add the ability to specify an install_dir to the gem module * Add GEM_HOME when installing a non-global gem * Add tests for custom gem path * Fix sanity tests * Add changelog entry * Rebase and add tests for incorrect options Co-authored by: Antoine Catton <devel@antoine.catton.fr>
…38195) * Add the ability to specify an install_dir to the gem module * Add GEM_HOME when installing a non-global gem * Add tests for custom gem path * Fix sanity tests * Add changelog entry * Rebase and add tests for incorrect options Co-authored by: Antoine Catton <devel@antoine.catton.fr>
…38195) * Add the ability to specify an install_dir to the gem module * Add GEM_HOME when installing a non-global gem * Add tests for custom gem path * Fix sanity tests * Add changelog entry * Rebase and add tests for incorrect options Co-authored by: Antoine Catton <devel@antoine.catton.fr>
SUMMARY
Some system administrator want to separate some gem installation from the rest
of the system. A good example is
gem install --install-dir /opt/fluentd fluentd
.This pull request allows users of the
gem
module in Ansible to specify adirectory where the gem is going to be installed.
In addition to the future, this adds partial tests for the module in question.
ISSUE TYPE
COMPONENT NAME
module:
packaging.languages.gem
ANSIBLE VERSION
ADDITIONAL INFORMATION
N/A