Difference between revisions of "Xs-rpmlint-2012-11-19-output"

From CDOT Wiki
Jump to: navigation, search
Line 21: Line 21:
  
 
The backup-available.py file is in "server" directory:
 
The backup-available.py file is in "server" directory:
 +
<nowiki>
 
$ ls -ld server
 
$ ls -ld server
 
drwxr-xr-x. 2 zyu26 zyu26 4096 Feb 10  2012 server
 
drwxr-xr-x. 2 zyu26 zyu26 4096 Feb 10  2012 server
Line 107: Line 108:
 
         os.system('find ' + recentclientsdir + ' -type f -mmin +10 -print0 | xargs -0 -n 100 --no-run-if-empty rm' )
 
         os.system('find ' + recentclientsdir + ' -type f -mmin +10 -print0 | xargs -0 -n 100 --no-run-if-empty rm' )
 
     return apache.OK
 
     return apache.OK
 +
</nowiki>

Revision as of 20:09, 22 November 2012

[zyu26@localhost SPECS]$ rpmlint -i ~/rpmbuild/RPMS/noarch/ds-backup-server-0.11.5.g536d1d6-3.fc17.noarch.rpm

ds-backup-server.noarch: E: script-without-shebang /var/www/ds-backup/backup-available.py This text file has executable bits set or is located in a path dedicated for executables, but lacks a shebang and cannot thus be executed. If the file is meant to be an executable script, add the shebang, otherwise remove the executable bits or move the file elsewhere.

ds-backup-server.noarch: W: no-manual-page-for-binary ds-postprocess.py Each executable in standard binary directories should have a man page.

ds-backup-server.noarch: W: no-manual-page-for-binary ds-cleanup.sh Each executable in standard binary directories should have a man page.

ds-backup-server.noarch: W: no-manual-page-for-binary ds-cleanup.py Each executable in standard binary directories should have a man page.

1 packages and 0 specfiles checked; 1 errors, 3 warnings.


The backup-available.py file is in "server" directory: $ ls -ld server drwxr-xr-x. 2 zyu26 zyu26 4096 Feb 10 2012 server ls -l server total 40 -rw-r--r--. 1 zyu26 zyu26 451 Feb 10 2012 apache-ds-backup.conf -rw-r--r--. 1 zyu26 zyu26 2144 Feb 10 2012 backup-available.py -rw-r--r--. 1 zyu26 zyu26 253 Feb 10 2012 cron-ds-backup-server.conf -rwxr-xr-x. 1 zyu26 zyu26 322 Feb 10 2012 ds-backup.setup.sh -rwxr-xr-x. 1 zyu26 zyu26 6595 Feb 10 2012 ds-cleanup.py -rwxr-xr-x. 1 zyu26 zyu26 1312 Feb 10 2012 ds-cleanup.sh -rwxr-xr-x. 1 zyu26 zyu26 3650 Feb 10 2012 ds-postprocess.py -rw-r--r--. 1 zyu26 zyu26 394 Feb 10 2012 incron-ds-backup.comments -rw-r--r--. 1 zyu26 zyu26 84 Feb 10 2012 incron-ds-backup.conf $ cat backup-available.py # this is not a cgi script # will only work as a mod_python handler from mod_python import apache import os import re import pwd import random def handler(req): recentclientsdir = '/var/lib/ds-backup/recentclients' basehomedir = '/library/users' req.content_type= 'text/plain' # max 5% loadavg if (os.getloadavg()[0] > 5): return apache.HTTP_SERVICE_UNAVAILABLE # we need at least a few blocks... libstat = os.statvfs(basehomedir); usedblockspc = 1 - float(libstat[4])/libstat[2] usedfnodespc = 1 - float(libstat[7])/libstat[5] if (usedblockspc > 0.9 or usedfnodespc > 0.9): return apache.HTTP_SERVICE_UNAVAILABLE # Limit concurrent rsync clients # We touch a file with the client identifier # every time we reply with a 200 OK. So # we can check for recent "OKs". # (clients that retry the rsync transfer won't # re-request this url, anyway.) clientcount = os.system('find ' + recentclientsdir + ' -mmin -5 -type f | wc -l'); if (clientcount > 10 ): return apache.HTTP_SERVICE_UNAVAILABLE # Read the XO SN req.add_common_vars() pathinfo = req.subprocess_env['PATH_INFO'] m = re.match('/available/(\w+)$', pathinfo) if (m): # req.log_error(clientid) clientid = m.group(1) else: # We don't like your SN return apache.HTTP_FORBIDDEN # Have we got a user acct for the user? try: homedir = pwd.getpwnam(clientid)[5] except KeyError: return apache.HTTP_FORBIDDEN # check the homedir is in the right place m = re.match(basehomedir, homedir) if (not m): return apache.HTTP_FORBIDDEN #return apache.HTTP_UNAUTHORIZED #return apache.HTTP_FORBIDDEN #return apache.HTTP_VERSION_NOT_SUPPORTED # req.write('') os.system('touch ' + recentclientsdir + '/' + clientid) # TODO: 1 in 10, cleanup recentclients dir if (random.randint(0,10) == 1): os.system('find ' + recentclientsdir + ' -type f -mmin +10 -print0 | xargs -0 -n 100 --no-run-if-empty rm' ) return apache.OK