-
-
Notifications
You must be signed in to change notification settings - Fork 136
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 rvm1_delete_unmanaged_rubies option (and deprecate rvm1_delete_ruby) #222
Conversation
This new opt-in variable is intended to supersede the former rvm1_delete_ruby option (hence its deprecation).
A few quick thoughts (I'm on the move):
Again raw thoughts, I'm on the move, but thanks for taking a stab at this, I'll let other comment! |
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.
I think its a good idea and I think I prefer the rvm_delete_unmanaged_rubies
over an explicit rvm_delete_rubies
list. I'd prefer not to maintain separate install and delete lists. But I'm not against the list method if it seems safer, although not sure if that's true.
One question I have (not having a lot of experience with rvm outside of minimal use of this role), since I think rvm will not be able to delete system (non-rvm installed) rubies, should we add something to explain this? To avoid confusion with the unmanaged
term.
tasks/rubies.yml
Outdated
register: rvm_delete_rubies_command_result | ||
changed_when: "'#removing' in rvm_delete_rubies_command_result.stdout" | ||
when: rvm1_delete_unmanaged_rubies|bool | ||
with_items: '{{ rvm1_list_installed_rubies.stdout.splitlines() | difference(rvm1_rubies|default([])) }}' |
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.
I think loop
is now preferred over with_items
.
https://docs.ansible.com/ansible/latest/user_guide/playbooks_loops.html
And maybe use rvm1_list_installed_rubies.stdout_lines
instead of rvm1_list_installed_rubies.stdout.splitlines()
.
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.
I copy-pasted rvm1_list_installed_rubies.stdout.splitlines()
from the existing tasks, but thank you for giving this hint. I'll change it in both tasks.
About loop
versus with_items
: Since all the "looping" tasks in this role are still using the original with_items
style, I didn't want to mix both syntaxes. I won't change it for the moment, and would propose to convert all the relevant tasks via a single ad-hoc commit.
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.
See fada459
- Expect that rvm1_delete_unmanaged_rubies value is a valid YAML boolean. Adapt README example in this way. Drop '|bool' filter. - Fix broken --check mode (by registering rvm1_list_installed_rubies variable in check mode as well). - Use '.stdout_lines' helper rather than '.stdout.splitlines()'
@thbar @danochoa Thank you very much for all your inputs 💓 With fada459, I think that I've already fixed a good part of the requests that you raised. Preamble/Disclaimer (that I should have posted in the PR description 🙈):
Now here my comments/answers to the following points:
@pkuczynski What are your thoughts about that point? (Backwards compatibility, Semantic versioning,...)
The check mode is now fixed (fada459) and I doubt that
The variable name Thank you again for your help on this 😃 |
I think dropping a function, bumping the version, and mentioning in the changelog's section Breaking Changes, should be enough if we feel that maintaining something does not make any sense or goes against the new direction of the package. |
@gildegoma I will be able to test beginning of next week. Will comment back unless someone approves before! |
@gildegoma can't test this for now actually, but will have a bit more time next month. I'll report back if/when I can. |
I'm a little torn on this one. On the one hand, it is very nice to be Declarative and to be able to say "These Rubies should exist, no more, no less. Don't care what was there before – Let's clean it up to be in this state now.". However, this can have unexpected consequence for some workflows. I would not be surprised if someone deployed RVM+Ruby to existing servers in their organization using a brand new playbook (and not knowing that someone else has installed RVM + a Ruby version already). The removal would certainly cause some applications to break. I am thinking about how different the proposed behavior is to this convention in Ansible:
...By saying I want these 2 packages, I'm not implying that Ansible should remove All of the other packages on the system not mentioned here. I know this is an unfair comparison, but I'm trying to thinking of any precedent for this sort of convention in Ansible and I can't think of one. |
I also have the same feeling. Removing everything that is not explicitly specified, while nice in theory, could end up with troubles. Worst case it is easy for someone to create a task to issue multiple deletes, and over 5 years of Ruby maintenance I mostly have to delete one or two rubies at a time, to N calls to |
Lets then close it in favor of #221 |
This new feature came to my mind after following discussion.