Changeset 1613
- Timestamp:
- Nov 11, 2008, 3:50:13 AM (16 years ago)
- Location:
- trunk/packages
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/packages/invirt-base/debian/changelog
r1612 r1613 2 2 3 3 * Move useful Python exceptions into invirt.common 4 5 -- Evan Broder <broder@mit.edu> Tue, 11 Nov 2008 00:32:19 -0500 4 * Move the remctl code out of the website and into invirt-base 5 6 -- Evan Broder <broder@mit.edu> Tue, 11 Nov 2008 01:14:42 -0500 6 7 7 8 invirt-base (0.0.8) unstable; urgency=low -
trunk/packages/invirt-web/code/controls.py
r1612 r1613 1 """2 Functions to perform remctls.3 """4 5 1 import validation 6 2 from invirt.common import CodeError, InvalidInput 7 3 import random 8 import subprocess9 4 import sys 10 5 import time … … 15 10 from invirt.config import structs as config 16 11 from invirt.database import Machine, Disk, Type, NIC, CDROM, session, meta 12 from invirt.remctl import remctl 17 13 18 14 # ... and stolen from xend/uuid.py … … 27 23 "%02x" * 6]) % tuple(u) 28 24 # end stolen code 29 30 def kinit():31 """Kinit with a given username and keytab"""32 p = subprocess.Popen(['kinit', "-k", "-t", '/etc/invirt/keytab',33 'daemon/'+config.web.hostname],34 stderr=subprocess.PIPE)35 e = p.wait()36 if e:37 raise CodeError("Error %s in kinit: %s" % (e, p.stderr.read()))38 39 def checkKinit():40 """If we lack tickets, kinit."""41 p = subprocess.Popen(['klist', '-s'])42 if p.wait():43 kinit()44 45 def remctl(*args, **kws):46 """Perform a remctl and return the output.47 48 kinits if necessary, and outputs errors to stderr.49 """50 checkKinit()51 p = subprocess.Popen(['remctl', config.remote.hostname]52 + list(args),53 stdout=subprocess.PIPE,54 stderr=subprocess.PIPE)55 v = p.wait()56 if kws.get('err'):57 return p.stdout.read(), p.stderr.read()58 if v:59 print >> sys.stderr, 'Error', v, 'on remctl', args, ':'60 print >> sys.stderr, p.stderr.read()61 raise CodeError('ERROR on remctl')62 return p.stdout.read()63 25 64 26 def lvcreate(machine, disk): -
trunk/packages/invirt-web/code/main.py
r1612 r1613 44 44 from invirt.config import structs as config 45 45 from invirt.common import InvalidInput, CodeError 46 from invirt.remctl import remctl 46 47 47 48 def pathSplit(path):
Note: See TracChangeset
for help on using the changeset viewer.