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 method get_bin_path to module_common and update modules to use it #968
Conversation
This is meant to assist all the modules that look for the full path of an executable. If it is found and is X_OK, returns the full path. Otherwise, it returns None.
The optional list is prepended to PATH. Fix get_bin_path() to use os.path.join().
* Migraed easy_install, pip, service, setup, and user. * Updated fail_json message in apt_repository * Fixed easy_install to not hardcode location of virtualenv in /usr/local/bin/. * Made handling of virtualenv more consistent between easy_install and pip.
A few small things I found that would reduce the amount of boilerplate involved: In a few places we have code like this in the module:
Here, rather than just calling the get bin path inside another function, I think we'd use to add a module.get_bin_path(..., required=True) or something, such that we can eliminate this boilerplate as well across the board. If the path is not found it could automatically fail, which eliminates the need for the wrapper function as well as the "if bin is None" logic. In the supervisorctl module:
It looks like the _find_supervisorctl function should be removed. Other than that, looks solid. |
On Thu, Aug 30, 2012 at 5:16 AM, Michael DeHaan notifications@github.comwrote:
Sure, that will make the modules a bit cleaner. :-)
I'll prune that from the supervisorctl module. I tried to tread lightly sf |
Added required as optional argument to get_bin_path(). It defaults to false. Updated following modules to use required=True when calling get_bin_path(): apt_repository, easy_install, group, pip, supervisorctl, and user. Also removed _find_supervisorctl() from supervisorctl module and updated _is_running() to not need it.
Commit 6742e9c should address the above issues. |
Following up on #903, this adds get_bin_path to module_common and updates modules to use it.
Please let me know if you have any comments/questions. Thanks. :-)