Additional LWRP options (with tests), including execute as non-root #7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.