librato / librato-collectd-docker

Collectd plugin for Docker cgroup metrics
MIT License
9 stars 7 forks source link

Python2.6 compatibility #3

Closed obfuscurity closed 9 years ago

obfuscurity commented 9 years ago
$ DEBUG=1 /usr/share/collectd/collectd-docker.py
  File "/usr/share/collectd/collectd-docker.py", line 175
    'docker-librato.\w+.cpu_stats.*',
                                    ^
SyntaxError: invalid syntax

Reported by @jzruscio.

obfuscurity commented 9 years ago

The above error is easily fixed by changing from set literal syntax, e.g. {1, 2, 3} to a list, e.g. [1, 2, 3]. However I'm running into other, more challenging hurdles.

$ DEBUG=1 ./python ../librato-collectd-docker/collectd-docker.py
Traceback (most recent call last):
  File "../librato-collectd-docker/collectd-docker.py", line 20, in <module>
    import urllib2
  File "/home/vagrant/Python-2.6.9/Lib/urllib2.py", line 93, in <module>
    import hashlib
  File "/home/vagrant/Python-2.6.9/Lib/hashlib.py", line 138, in <module>
    sha224 = __get_builtin_constructor('sha224')
  File "/home/vagrant/Python-2.6.9/Lib/hashlib.py", line 66, in __get_builtin_constructor
    import _sha256
ImportError: No module named _sha256
obfuscurity commented 9 years ago

The aforementioned _sha256 error is a result of my source build of python2.6 on my test Ubuntu 12.04 system, not a bug in the script. Unfortunately despite all my best efforts tonight I've been unable to build a working python2.6 with hashlib. Considering that python2.6.9 packages (a security release) are, to the best of my knowledge, not available, I think it's safe to say that 2.6 compatibility is a lost cause. Python2.7 should be considered a minimum requirement.