Additional LWRP options (with tests), including execute as non-root#7
Additional LWRP options (with tests), including execute as non-root#7bdclark wants to merge 2 commits intorosstimson:masterfrom bdclark:bclark_wip
Conversation
- 'install_deps' attribute (bool, default true) provides for execution as a non-priveleged user without worrying about ruby-install attempting to sudo. - Additional ruby-install options including patch, source_dir, mirror, url, md5 included as optional attributes for additional completeness
…talls - user_ruby test cookbook has attributes and recipe for testing non-root ruby installs as well as patched installs - test-kitchen suite and serverspec test for installing ruby as vagrant user into into ~/.rubies - test-kitchen suite and serverspec test for installing a patched ruby 2.0 into Ubuntu-14.04 (problematic otherwise due to readline issues)
|
This looks like awesome work. Please give me a day or two to test this and get a new release out. Thanks you very much! |
|
Thanks! (and sorry for the delayed response). You might want to sit on this PR and leave it open for a while. I took the liberty of banging around on your LWRP today and hope to push something this weekend. It should include most everything addressed in this PR, but should deal with most of it within the LWRP itself. I hope to have some unit and integration tests done this weekend (almost there). Current progress is here |
|
@bdclark Still sitting on this. Is this something you are still looking at doing when you get some time or shall I just look to pull in what we've got here? |
|
Sorry about that @rosstimson... got a new job recently and have been overwhelmed. For now let's ignore my last comment, I'll drop my second wip branch and possibly revisit later. I'll leave this PR intact, so feel free to move forward with it if you want to. Thx! |
This PR was created to address two issues... successfully installing a ruby as a non-privileged user (eg. to
~/.rubieswith proper ownership) and to allow patched installations.To install a ruby as a non-root user (eg. as vagrant:vagrant into ~/.rubies), we need to be able to pass the
--no-install-depsflag to ruby-install. Otherwise the run will likely puke when ruby-install is executed as non-root and attempts to sudo to install deps (well, at leat in my test env). To allow for patched installs, we need the--patchoption. In addition to these options, I also added some others for the sake of completeness (though not all of them).I also included a commit that contains a test cookbook
user_rubyand related test-kitchen suites and serverspec tests to exemplify the items mentioned above. This includes a) installing a ruby as vagrant to its home directory, and b) installing a patched ruby 2.0 into Ubuntu-14.04 (which is otherwise impossible to install due to issues w/ readline).The
user_rubytest cookbook includes some comments to give an example pattern of installing a ruby to a user's home directory. As long as theinstall_depsattribute is exposed in the LWRP, this should address issue #1. With it, the only attributes needed to install a ruby is the username of an (existing) user and the actual ruby to be installed. The rest can be determined with some help from our good friendetc.As a side note, some of the logic included in the
user_rubytest cookbook could be integrated directly into the LWRP, albeit at the possible expense of making it slightly more "opinionated". I guess it depends on whether the intent is to leave it all up to the implementer, or to provide reasonable (and overridable) defaults that mimic the actual ruby-install command. I'll save that for another comment/issue.Please feel free to merge, cherry-pick, provide feedback for edits, etc.