[Commits] act-server branch master updated.
C. Scott Ananian (none)
cscott at activation
Tue Dec 2 16:26:23 EST 2008
This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "/home/cscott/public_git/act-server".
The branch, master has been updated
via 3168d19cc86ca733826bc11e086dd182de64ff62 (commit)
from 958fb3d90add56a42b0cd77d0692f891f1918503 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
...jango-group-sizes.py => django-export-group.py} | 16 ++++++++++----
scripts/django-export-loc.py | 22 ++++++++++++++++++++
2 files changed, 33 insertions(+), 5 deletions(-)
copy scripts/{django-group-sizes.py => django-export-group.py} (60%)
create mode 100755 scripts/django-export-loc.py
- Log -----------------------------------------------------------------
commit 3168d19cc86ca733826bc11e086dd182de64ff62
Author: C. Scott Ananian <cscott at activation.(none)>
Date: Tue Dec 2 16:26:16 2008 -0500
Add a pair of new utility scripts to export lists of serial numbers.
diff --git a/scripts/django-export-group.py b/scripts/django-export-group.py
new file mode 100755
index 0000000..9d88b14
--- /dev/null
+++ b/scripts/django-export-group.py
@@ -0,0 +1,41 @@
+#!/usr/bin/python2.4
+"""Emit lists of serial numbers in a given update or laptop group."""
+import sys
+sys.path.append(sys.path[0]+'/..')
+from django.core.management import setup_environ
+from oats import settings
+setup_environ(settings)
+
+from oats.gts.models import UpdateGroup, Laptop, LaptopGroup
+
+def ugsize():
+ for ug in UpdateGroup.objects.all():
+ print str(ug), Laptop.objects.filter(update_group=ug).count()
+def lgsize():
+ for lg in LaptopGroup.objects.all():
+ print str(lg), Laptop.objects.filter(other_groups=lg).count()
+
+def main():
+ from optparse import OptionParser
+ parser = OptionParser(usage='%prog [-l] [-u]')
+ parser.add_option('-u','--update',action='store',dest='update',
+ default=False,
+ help='Show sizes of update groups (default).')
+ parser.add_option('-l','--laptop',action='store',dest='laptop',
+ default=False,
+ help='Show sizes of laptop groups.')
+ (options, args) = parser.parse_args()
+ if args:
+ parser.error("Extra arguments.")
+ if options.laptop:
+ lg = LaptopGroup.objects.get(description__contains=options.laptop)
+ for l in Laptop.objects.filter(other_groups=lg):
+ print l.serial_number
+ elif options.update:
+ ug = UpdateGroup.objects.get(description__contains=options.update)
+ for l in Laptop.objects.filter(update_group=ug):
+ print l.serial_number
+ else:
+ parser.error("Need one of -u or -l, please.")
+
+if __name__ == '__main__': main ()
diff --git a/scripts/django-export-loc.py b/scripts/django-export-loc.py
new file mode 100755
index 0000000..e91769c
--- /dev/null
+++ b/scripts/django-export-loc.py
@@ -0,0 +1,22 @@
+#!/usr/bin/python2.4
+"""Emit lists of serial numbers in a given update or laptop group."""
+import sys
+sys.path.append(sys.path[0]+'/..')
+from django.core.management import setup_environ
+from oats import settings
+setup_environ(settings)
+
+from oats.gts.models import UpdateGroup, Laptop, LaptopGroup, MfgData
+
+def main():
+ from optparse import OptionParser
+ parser = OptionParser(usage='%prog [loc]')
+ (options, args) = parser.parse_args()
+ if len(args) > 1:
+ parser.error("Extra arguments.")
+ elif len(args) == 0:
+ parser.error("Not enough arguments.")
+ for md in MfgData.objects.filter(tag='LOC', data=args[0]):
+ print md.laptop.serial_number
+
+if __name__ == '__main__': main ()
-----------------------------------------------------------------------
--
/home/cscott/public_git/act-server
More information about the Commits
mailing list