{"action":"created","issue":{"url":"https://api.github.com/repos/saltstack/salt-bootstrap/issues/666","repository_url":"https://api.github.com/repos/saltstack/salt-bootstrap","labels_url":"https://api.github.com/repos/saltstack/salt-bootstrap/issues/666/labels{/name}","comments_url":"https://api.github.com/repos/saltstack/salt-bootstrap/issues/666/comments","events_url":"https://api.github.com/repos/saltstack/salt-bootstrap/issues/666/events","html_url":"https://github.com/saltstack/salt-bootstrap/pull/666","id":109415156,"number":666,"title":"Virtualenv support for Ubuntu","user":{"login":"l2ol33rt","id":1453062,"avatar_url":"https://avatars.githubusercontent.com/u/1453062?v=3","gravatar_id":"","url":"https://api.github.com/users/l2ol33rt","html_url":"https://github.com/l2ol33rt","followers_url":"https://api.github.com/users/l2ol33rt/followers","following_url":"https://api.github.com/users/l2ol33rt/following{/other_user}","gists_url":"https://api.github.com/users/l2ol33rt/gists{/gist_id}","starred_url":"https://api.github.com/users/l2ol33rt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/l2ol33rt/subscriptions","organizations_url":"https://api.github.com/users/l2ol33rt/orgs","repos_url":"https://api.github.com/users/l2ol33rt/repos","events_url":"https://api.github.com/users/l2ol33rt/events{/privacy}","received_events_url":"https://api.github.com/users/l2ol33rt/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":13,"created_at":"2015-10-02T01:24:06Z","updated_at":"2016-04-13T09:04:01Z","closed_at":"2016-04-13T09:04:01Z","pull_request":{"url":"https://api.github.com/repos/saltstack/salt-bootstrap/pulls/666","html_url":"https://github.com/saltstack/salt-bootstrap/pull/666","diff_url":"https://github.com/saltstack/salt-bootstrap/pull/666.diff","patch_url":"https://github.com/saltstack/salt-bootstrap/pull/666.patch"},"body":"Proposing two new flags:\r\n```bash\r\n  -V :  Install salt into virtualenv. If combined with -a all python pkgs will be installed into a virtualenv\r\n  -a :  Install all python pkgs via pip using salts zeromq.txt in requirements but all requires -V to keep python system packages unchanged.\r\n```\r\n\r\nI figured it was worth having two different flags since you could opt to have just salt installed into a virtualenv `(-V)` which will also leverage `--system-site-packages`.   Or install salt with all python packages via pip into a virtualenv `(-a)`.\r\n\r\nIt currently only works for Ubuntu and added the necessary checks for it to error out in the case that those flags try to run on something other than Ubuntu. Also it only works when using the git installs.\r\n\r\nMy goal here was to have a neat virtualenv that includes only salt and its requirements. Its been very useful for development since I can install separate virtualenvs on the same host and modify /etc/default/salt-master to switch between them.\r\n\r\nI broke out the pip installation to its own function `__install_pip_deps` so that other distros could eventually leverage this. \r\n\r\nHere's output from the 2 different runs:\r\n\r\n## Running with `-V` and `-a`: ##\r\nTested on `Ubuntu 14.04`\r\n```bash\r\n~# cat /etc/os-release\r\nNAME=\"Ubuntu\"\r\nVERSION=\"14.04.2 LTS, Trusty Tahr\"\r\nID=ubuntu\r\n```\r\n\r\nInstalling salt and all pip pkgs into a virtualenv\r\n```bash\r\n~# ./bootstrap-salt.sh -M -A 127.0.0.1 -a -V /usr/lib/virtualenv/salt git 2015.8\r\n```\r\n\r\nActivate virtualenv (just includes pip packages for salt)\r\n```bash\r\n~# source /usr/lib/virtualenv/salt/bin/activate\r\n(salt)~# pip freeze\r\nbackports.ssl-match-hostname==3.4.0.2\r\ncertifi==2015.9.6.2\r\nfutures==3.0.3\r\nJinja2==2.8\r\nMarkupSafe==0.23\r\nmsgpack-python==0.4.6\r\npycrypto==2.6.1\r\nPyYAML==3.11\r\npyzmq==14.7.0\r\nrequests==2.7.0\r\nsalt===2015.8.0-107-g1a31b19\r\ntornado==4.2.1\r\nwheel==0.24.0\r\n```\r\n\r\nAccept the keys and run salt\r\n```bash\r\n(salt)~# salt-key -A -y\r\nThe following keys are going to be accepted:\r\nUnaccepted Keys:\r\nsalt-master\r\nKey for minion salt-master accepted.\r\n\r\n(salt)~# salt ‘*’ test.ping\r\nsalt-master:\r\n    True\r\n```\r\n\r\n## With just -V flag ##\r\nTested on `Ubuntu 14.04`\r\n```bash\r\n~# cat /etc/os-release\r\nNAME=\"Ubuntu\"\r\nVERSION=\"14.04.2 LTS, Trusty Tahr\"\r\nID=ubuntu\r\n\r\nInstalling salt and all pip pkgs into a virtualenv\r\n```bash\r\n~# ./bootstrap-salt.sh -M -A 127.0.0.1 -P -V /usr/lib/virtualenv/salt git 2015.8\r\n```\r\n\r\nActivate virtualenv\r\n```bash\r\n~# source /usr/lib/virtualenv/salt/bin/activate\r\n(salt)~# pip freeze\r\nCheetah==2.4.4\r\nJinja2==2.7.2\r\nLandscape-Client==14.12\r\nM2Crypto==0.21.1\r\nMarkupSafe==0.18\r\nPAM==0.4.2\r\nPyYAML==3.10\r\nSecretStorage==2.0.0\r\nTwisted-Core==13.2.0\r\nTwisted-Names==13.2.0\r\nTwisted-Web==13.2.0\r\napt-xapian-index==0.45\r\nargparse==1.2.1\r\nbackports.ssl-match-hostname==3.4.0.2\r\ncertifi==2015.9.6.2\r\nchardet==2.0.1\r\ncloud-init==0.7.5\r\ncolorama==0.2.5\r\nconfigobj==4.7.2\r\nhtml5lib==0.999\r\nhttplib2==0.8\r\njsonpatch==1.3\r\njsonpointer==1.0\r\nkeyring==3.5\r\nlaunchpadlib==1.10.2\r\nlazr.restfulclient==0.13.3\r\nlazr.uri==1.0.3\r\nmsgpack-python==0.3.0\r\noauth==1.0.1\r\nprettytable==0.7.2\r\npyOpenSSL==0.13\r\npycrypto==2.6.1\r\npycurl==7.19.3\r\npygobject==3.12.0\r\npyserial==2.6\r\npython-apt==0.9.3.5ubuntu1\r\npython-debian==0.1.21-nmu2ubuntu2\r\npyzmq==14.0.1\r\nrequests==2.2.1\r\nsalt==2015.8.0-114-gdb963b7\r\nsimplejson==3.3.1\r\nsix==1.5.2\r\nssh-import-id==3.21\r\ntornado==4.2.1\r\nurllib3==1.7.1\r\nvirtualenv==1.11.4\r\nwadllib==1.3.2\r\nwheel==0.24.0\r\nwsgiref==0.1.2\r\nzope.interface==4.0.5\r\n```\r\n\r\nAccept the keys and run salt\r\n```bash\r\n(salt)~# salt-key -A -y\r\nThe following keys are going to be accepted:\r\nUnaccepted Keys:\r\nsalt-master\r\nKey for minion salt-master accepted.\r\n\r\n(salt)~# salt '*' test.ping\r\nsalt-master:\r\n    True\r\n```\r\n\r\nReally would enjoy your thoughts and suggestions on this!"},"comment":{"url":"https://api.github.com/repos/saltstack/salt-bootstrap/issues/comments/209319367","html_url":"https://github.com/saltstack/salt-bootstrap/pull/666#issuecomment-209319367","issue_url":"https://api.github.com/repos/saltstack/salt-bootstrap/issues/666","id":209319367,"user":{"login":"jfindlay","id":702905,"avatar_url":"https://avatars.githubusercontent.com/u/702905?v=3","gravatar_id":"","url":"https://api.github.com/users/jfindlay","html_url":"https://github.com/jfindlay","followers_url":"https://api.github.com/users/jfindlay/followers","following_url":"https://api.github.com/users/jfindlay/following{/other_user}","gists_url":"https://api.github.com/users/jfindlay/gists{/gist_id}","starred_url":"https://api.github.com/users/jfindlay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jfindlay/subscriptions","organizations_url":"https://api.github.com/users/jfindlay/orgs","repos_url":"https://api.github.com/users/jfindlay/repos","events_url":"https://api.github.com/users/jfindlay/events{/privacy}","received_events_url":"https://api.github.com/users/jfindlay/received_events","type":"User","site_admin":false},"created_at":"2016-04-13T09:04:01Z","updated_at":"2016-04-13T09:04:01Z","body":"@l2ol33rt, thanks for the excellent addition.  I'm going to close this now that #803 is merged."}}