Troubleshooting: Cron <root@localhost> /usr/share/l.v.e-manager/utils/cache_pypindex.py

Your cache_pypiindex.py cron job error may look similar to the following:

/usr/share/l.v.e-manager/utils/cache_pypindex.py

Traceback (most recent call last):
File "/usr/share/l.v.e-manager/utils/cache_pypindex.py", line 39, in <module>
main()
File "/usr/share/l.v.e-manager/utils/cache_pypindex.py", line 35, in main
ExtensionInfo().write_cache()
File "/usr/lib/python2.6/site-packages/clselect/clselectpython/extensions.py", line 35, in write_cache
extensions = self._rpc.list_packages()
File "/usr/lib64/python2.6/xmlrpclib.py", line 1199, in __call__
return self.__send(self.__name, args)
File "/usr/lib64/python2.6/xmlrpclib.py", line 1489, in __request
verbose=self.__verbose
File "/usr/lib64/python2.6/xmlrpclib.py", line 1235, in request
self.send_content(h, request_body)
File "/usr/lib64/python2.6/xmlrpclib.py", line 1349, in send_content
connection.endheaders()
File "/usr/lib64/python2.6/httplib.py", line 908, in endheaders
self._send_output()
File "/usr/lib64/python2.6/httplib.py", line 780, in _send_output
self.send(msg)
File "/usr/lib64/python2.6/httplib.py", line 739, in send
self.connect()
File "/usr/lib64/python2.6/httplib.py", line 720, in connect
self.timeout)
File "/usr/lib64/python2.6/socket.py", line 553, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
socket.gaierror: [Errno -2] Name or service not known

What it's doing

This script generates a list of available python extensions from pypi (https://pypi.python.org/pypi ) and stores it itn /var/lve/pypindex. The number of lines in this file should be the same as the number of available packages in pypi, at the time of this writing that is 59655. You can check this against your file with the word count command and the line count option as follows

# wc -l /var/lve/pypindex
59655 /var/lve/pypindex

The script supports a -d option to remove this cache file and running the script successfully with no options should generate it.

# /usr/share/l.v.e-manager/utils/cache_pypindex.py -h
Usage: /usr/share/l.v.e-manager/utils/cache_pypindex.py [-d]
Options:
 -h | --help   : print this message
 -d | --delete : delete cache
# /usr/share/l.v.e-manager/utils/cache_pypindex.py -d
# /usr/share/l.v.e-manager/utils/cache_pypindex.py
# stat /var/lve/pypindex
  File: `/var/lve/pypindex'
  Size: 762624          Blocks: 1496       IO Block: 4096   regular file
Device: fd00h/64768d    Inode: 16123159    Links: 1
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
Access: 2015-05-14 16:46:06.897967456 -0700
Modify: 2015-05-14 16:46:06.903967456 -0700
Change: 2015-05-14 16:46:06.904967456 -0700

What’s wrong / Troubleshooting options

If this script failed chances are either it could not write the cache file or it could not connect to pypi at the time the cron job ran, first run it again by hand to see if the problem still exists.

/usr/share/l.v.e-manager/utils/cache_pypindex.py

If it fails you can optionally run it with strace to get some more details

strace /usr/share/l.v.e-manager/utils/cache_pypindex.py 2>&1 |more 

The strace output will show you a query to your resolvers, in this example public google resovlers 8.8.4.4 and 8.8.8.8 and a query to pypi.python.org which resovles to 23.235.47.223 at this time:

socket(PF_INET, SOCK_DGRAM|SOCK_NONBLOCK, IPPROTO_IP) = 3
connect(3, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("8.8.4.4")}, 16) = 0
poll([{fd=3, events=POLLOUT}], 1, 0)    = 1 ([{fd=3, revents=POLLOUT}])
sendto(3, "\322w\1\0\0\1\0\0\0\0\0\0\4pypi\6python\3org\0\0\1\0"..., 33, MSG_NOSIGNAL, NULL, 0) = 33
poll([{fd=3, events=POLLIN|POLLOUT}], 1, 5000) = 1 ([{fd=3, revents=POLLOUT}])
sendto(3, "W\256\1\0\0\1\0\0\0\0\0\0\4pypi\6python\3org\0\0\34\0"..., 33, MSG_NOSIGNAL, NULL, 0) = 33
poll([{fd=3, events=POLLIN}], 1, 4999)  = 1 ([{fd=3, revents=POLLIN}])
ioctl(3, FIONREAD, [84])                = 0
recvfrom(3, "\322w\201\200\0\1\0\2\0\0\0\0\4pypi\6python\3org\0\0\1\0"..., 2048, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("8.8.4.4")}, [16]) = 84
poll([{fd=3, events=POLLIN}], 1, 4965)  = 1 ([{fd=3, revents=POLLIN}])
ioctl(3, FIONREAD, [140])               = 0
recvfrom(3, "W\256\201\200\0\1\0\1\0\1\0\0\4pypi\6python\3org\0\0\34\0"..., 1964, 0, {sa_family=AF_INET, sin_port=htons(53), sin_addr=inet_addr("8.8.4.4")}, [16]) = 140
close(3)                                = 0
socket(PF_INET, SOCK_STREAM, IPPROTO_TCP) = 3
connect(3, {sa_family=AF_INET, sin_port=htons(80), sin_addr=inet_addr("23.235.47.223")}, 16) = 0
sendto(3, "POST /pypi HTTP/1.0\r\nHost: pypi."..., 147, 0, NULL, 0) = 147
sendto(3, "<?xml version='1.0'?>\n<methodCal"..., 107, 0, NULL, 0) = 107

Check that your file system for /var is not full, not out of inodes, and not marked read only.

df -h && df -i
touch /var/lve/test
rm /var/lve/test

Check that you can resolve the domain and connect out on port 80

ping pypi.python.org
telnet pypi.python.org 80

Resolving issues above should allow the script to run okay. If you are still having trouble please open a ticket with support on this matter.