run-graphite-devel-server.py do not work on solaris 11

Bug #922728 reported by maduma
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Graphite
Fix Released
Undecided
Unassigned

Bug Description

the root cause is because 'which' unix cmd still return something even if the located cmd is not found.

$ which dummy
no dummy in /usr/bin /bin /usr/sbin /usr/cluster/bin /usr/sbin /opt/csw/bin

Here the patch files to fix run-graphite-devel-server.py

*** proto/opt/lx/graphite/bin/run-graphite-devel-server.py Fri Jan 27 16:57:54 2012
--- patches/bin/run-graphite-devel-server.py Fri Jan 27 17:05:32 2012
***************
*** 17,29 ****

  graphite_root = args[0]

! for name in ('django-admin', 'django-admin.py'):
! django_admin = os.popen('which %s' % name).read().strip()
! if django_admin: break

- if not django_admin:
- print "Could not find a django-admin script!"
- sys.exit(1)

  python_path = os.path.join(graphite_root, 'webapp')

--- 17,40 ----

  graphite_root = args[0]

! if os.uname()[0] == 'SunOS' and os.uname()[2] == '5.11':
! for name in ('django-admin', 'django-admin.py'):
! if os.popen('which %s' % name).close() == None:
! django_admin = name
! break
! try:
! django_admin
! except NameError:
! print "Could not find a django-admin script!"
! sys.exit(1)
! else:
! for name in ('django-admin', 'django-admin.py'):
! django_admin = os.popen('which %s' % name).read().strip()
! if django_admin: break
! if not django_admin:
! print "Could not find a django-admin script!"
! sys.exit(1)

  python_path = os.path.join(graphite_root, 'webapp')

Tags: solaris
Revision history for this message
Michael Leinartas (mleinartas) wrote :

Fixed in r705

Changed in graphite:
milestone: none → 0.9.10
status: New → Fix Committed
Revision history for this message
Nicholas Leskiw (nleskiw) wrote :

The implemented fix breaks compatibility with < python2.7.
We need to make sure to maintain compatibility back to python2.4.

Changed in graphite:
status: Fix Committed → Incomplete
Revision history for this message
Nicholas Leskiw (nleskiw) wrote :

more info: subprocess.check_output() is new in python2.7

Changed in graphite:
status: Incomplete → Confirmed
Revision history for this message
Michael Leinartas (mleinartas) wrote :

Thanks Nick, I missed the compatibility issue here.

Fix committed to r706 to use the full-blown subprocess.Popen syntax compatible with python2.4

Changed in graphite:
status: Confirmed → Fix Committed
Changed in graphite:
status: Fix Committed → Fix Released
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.