oracle-samples / knife-oci

Chef Knife Plugin for Oracle Cloud Infrastructure
https://cloud.oracle.com/cloud-infrastructure
Other
12 stars 15 forks source link

Fix so that missing argument without an underscore is printed correctly. #13

Closed jcobol closed 7 years ago

jcobol commented 7 years ago

Signed-off-by: john_l_hopkins john.l.hopkins@oracle.com

In bmcs_helper.rb validate_params, if the user is missing an argument that does not contain an underscore (eg. 'shape') then a blank is printed to the screen instead of the argument name.

The issue is with how tr! works in that case:

.gem :003 > "avdomain".tr!('','-') => "av-domain" ## works fine because string includes an underscore [vagrant@localhost knife-bmcs]$ irb .gem :001 > "shape".tr!('','-') => nil .gem :002 > "shape".tr('','-') => "shape"

The fix (as shown above) is to call tr instead of tr!