rvm / rvm1-ansible

The official ansible RVM role to install and manage your Ruby versions.
MIT License
271 stars 136 forks source link

Fix boolean values when checking array #207

Closed kubaw closed 4 years ago

kubaw commented 5 years ago

I think checking condition like this: rvm1_rubies | bool doesn't work for array. It is always false. This causes an error:

"stderr": "/bin/sh: /home/user/.rvm/wrappers//gem: not found"

Looks like checking using | length works for arrays but it is also works for strings.

pkuczynski commented 4 years ago

@kubaw thank you for your contribution and apologies for the late merge. I will invite you to the RVM team so you can have better influence on this package...

thbar commented 4 years ago

@rvm/ansible I have tested this PR successfully on a client deployment.

Not only the warnings disappears, but #209 also appears to be closed (I'll comment over there).

Logs before:

TASK [rvm.ruby : Detect if rubies are installed] ************************************************************
[DEPRECATION WARNING]: evaluating ['ruby-2.5.8', 'ruby-2.5.7', 'ruby-2.5.3'] as a bare variable, this 
behaviour will go away and you might need to add |bool to the expression in the future. Also see 
CONDITIONAL_BARE_VARS configuration toggle.. This feature will be removed in version 2.12. Deprecation 
warnings can be disabled by setting deprecation_warnings=False in ansible.cfg.
skipping: [vagrant-xyz] => (item=ruby-2.5.8) 
skipping: [vagrant-xyz] => (item=ruby-2.5.7) 
skipping: [vagrant-xyz] => (item=ruby-2.5.3) 

Logs after:

TASK [rvm.ruby : Detect if rubies are installed] ************************************************************
skipping: [vagrant-xyz] => (item=ruby-2.5.8) 
skipping: [vagrant-xyz] => (item=ruby-2.5.7) 
skipping: [vagrant-xyz] => (item=ruby-2.5.3) 

Thanks @kubaw!