Cmd2 module depends on 'which' utility

Bug #1379055 reported by Matt Kassawara
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
cliff
Fix Released
Medium
Nolan Brubaker

Bug Description

The cmd2 module used by cliff implements several methods to determine the system editor. One of these methods calls the 'which' system utility. If 'which' does not exist on the system, cmd2 generates an error that causes cliff and (in this particular case) python-neutronclient to fail.

# neutron agent-list
Traceback (most recent call last):
  File "/usr/bin/neutron", line 6, in <module>
    from neutronclient.shell import main
  File "/usr/lib/python2.7/site-packages/neutronclient/shell.py", line 28, in <module>
    from cliff import app
  File "/usr/lib/python2.7/site-packages/cliff/app.py", line 14, in <module>
    from .interactive import InteractiveApp
  File "/usr/lib/python2.7/site-packages/cliff/interactive.py", line 9, in <module>
    import cmd2
  File "/usr/lib/python2.7/site-packages/cmd2.py", line 361, in <module>
    class Cmd(cmd.Cmd):
  File "/usr/lib/python2.7/site-packages/cmd2.py", line 424, in Cmd
    if subprocess.Popen(['which', editor], stdout=subprocess.PIPE, stderr=subprocess.STDOUT).communicate()[0]:
  File "/usr/lib64/python2.7/subprocess.py", line 711, in __init__
    errread, errwrite)
  File "/usr/lib64/python2.7/subprocess.py", line 1327, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

Revision history for this message
Terry Howe (thowe-g) wrote :

In your environment, what do you get for:

import sys
print str(sys.platform)

Revision history for this message
Terry Howe (thowe-g) wrote :
Ian Cordasco (icordasc)
Changed in python-cliff:
assignee: nobody → Ian Cordasco (icordasc)
Revision history for this message
Ian Cordasco (icordasc) wrote :

Since this happens on import there's no way to have cliff handle this. A fix has been proposed https://bitbucket.org/catherinedevlin/cmd2/pull-request/6/in-the-event-which-is-not-installed-return/diff

Revision history for this message
Doug Hellmann (doug-hellmann) wrote :

I've had in the back of my mind that we want to drop our use of cmd2, since it's not well supported upstream. Maybe that's more expedient than waiting for the fix to be merged and a new release created.

Changed in python-cliff:
importance: Undecided → Medium
status: New → Triaged
Revision history for this message
Ian Cordasco (icordasc) wrote :

We could drop cmd2 or we could fork it to stackforge and fix it there and then depend on that. Thoughts?

Revision history for this message
Nolan Brubaker (nolan-brubaker) wrote :

This bug can probably be closed - from the #openstack-oslo IRC channel, Dec 4 2014 (EST):

12:46 sigmavirus24: dhellmann: thoughts on forking cmd2 to stackforge or would it be better to abandon it entirely? (re: https://bugs.launchpad.net/python-cliff/+bug/1379055)
12:48 dhellmann: sigmavirus24: I'm not sure we want to take over cmd2 maintenance. We could talk to Catherine about making a release, but she seems to have dropped support for the module. I had planned to stop using cmd2 anyway because of some issues we had getting a bug fix release a while back, I just never got around to it.
12:48 dims_ has joined (~<email address hidden>)
12:49 sigmavirus24: Sounds good to me
12:49 dhellmann: sigmavirus24: I guess that's the long way of saying, let's see what happens if we drop cmd2 and just use the stdlib cmd module

Changed in python-cliff:
assignee: Ian Cordasco (icordasc) → Nolan Brubaker (nolan-brubaker)
Revision history for this message
Nolan Brubaker (nolan-brubaker) wrote :

After some more discussion on IRC, Doug had rights to merge Ian's patch into cmd2, but not rights to do a new release on PyPI. Doug's emailing Catherine about a release and copying myself.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to cliff (master)

Fix proposed to branch: master
Review: https://review.openstack.org/140474

Changed in python-cliff:
status: Triaged → In Progress
Revision history for this message
Doug Hellmann (doug-hellmann) wrote :

cmd2 version 0.6.8 includes Ian's fix. I'm talking with Catherine about getting rights to publish new releases on PyPI (we're having some sort of technical issue) and assisting with maintenance.

Changed in python-cliff:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on cliff (master)

Change abandoned by Nolan Brubaker (<email address hidden>) on branch: master
Review: https://review.openstack.org/140474
Reason: Abandoning as this is the wrong place to change the requirements.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.