collective / collective.hostout

zc.buildout deployment and remote control
22 stars 7 forks source link

detecthostos fails (1.0a5) #6

Open auspex opened 13 years ago

auspex commented 13 years ago
Hostout: Running command 'detecthostos' from 'collective.hostout.fabfile'
[plone@nautilus-vm.mathstat.dal.ca:22] run: /bin/bash -l -c "PATH=\$PATH:\"/home/plone4/plone-cmb\" ([ -e /etc/SuSE-release ] && echo SuSE) || ([ -e /etc/redhat-release ] && echo redhat) || ([ -e /etc/fedora-release ] && echo fedora) || (lsb_release -is) || ([ -e /etc/slackware-version ] && echo slackware)"
[plone@nautilus-vm.mathstat.dal.ca:22] out: /bin/bash: -c: line 0: syntax error near unexpected token `('
[plone@nautilus-vm.mathstat.dal.ca:22] out: /bin/bash: -c: line 0: `PATH=$PATH:"/home/plone4/plone-cmb" ([ -e /etc/SuSE-release ] && echo SuSE) || ([ -e /et[plone@nautilus-vm.mathstat.dal.ca:22] out: /etc/fedora-release ] && echo fedora) || (lsb_release -is) || ([ -e /etc/slackware-version ] && echo slackware)'
[plone@nautilus-vm.mathstat.dal.ca:22] out: 

Fatal error: run() encountered an error (return code 2) while executing '([ -e /etc/SuSE-release ] && echo SuSE) || ([ -e /etc/redhat-release ] && echo redhat) || ([ -e /etc/fedora-release ] && echo fedora) || (lsb_release -is) || ([ -e /etc/slackware-version ] && echo slackware)'

Since this fails equally on my CentOS system and my Ubuntu system, I'm suspecting that you're actually setting the "shell" parameter mentioned in the changelog for 1.0a4, but it's undocumented and I don't know what to put there.

If I run the command directly on the deployment system, and remove the PATH setting (PATH=\$PATH:\"/home/plone4/plone-cmb\"), it works.

auspex commented 13 years ago

As a workaround, I modified fabfile.py as below. This is clearly wrong! :-)

hostos = api.run(
    "/bin/bash -l -c '([ -e /etc/SuSE-release ] && echo SuSE) || "
            "([ -e /etc/redhat-release ] && echo redhat) || "
            "([ -e /etc/fedora-release ] && echo fedora) || "
            "(lsb_release -is) || "
            "([ -e /etc/slackware-version ] && echo slackware)'"
           , shell=False)
auspex commented 13 years ago

Any chance of somebody finding a cleaner way to do this?

auspex commented 13 years ago

bump. This is causing problems everytime I deploy to a new site, and I'd really like someone to at least look at it and let me know what the right way to do this, is.