Changeset 801

Show
Ignore:
Timestamp:
09/06/08 15:00:54 (3 months ago)
Author:
free
Message:

Added _Apt class

Location:
ares/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • ares/trunk/ares.py

    r797 r801  
    6363        self.samba        = _Samba(self) 
    6464        self.nfs          = _Nfs(self) 
     65        self.havp         = _Havp(self) 
     66        self.apt          = _Apt(self) 
    6567        self.postconfig   = _Postconfig(self) 
    6668 
     
    542544 
    543545# 
     546# Havp 
     547# 
     548class _Havp: 
     549 
     550    def __init__(self, ares): 
     551        self._ares = ares 
     552        self._cfg  = '/files/etc/havp/havp.config' 
     553 
     554    def setup(self): 
     555 
     556        aug = self._ares.aug 
     557        cfg = self._cfg 
     558        aug.set(cfg + '/PARENTPROXY', 'localhost') 
     559        aug.set(cfg + '/PARENTPORT', '3128') 
     560 
     561# 
     562# Setup the APT repository 
     563# 
     564class _Apt: 
     565 
     566    def __init__(self, ares): 
     567        self._ares = ares 
     568        self._cfg = '/files/etc/apt/sources.list' 
     569 
     570    def setup(self): 
     571        cfg = self._cfg 
     572        aug = self._ares.aug 
     573 
     574        # Remove all previous entries 
     575        for key in aug.match(cfg + '/*'): 
     576            aug.remove(key) 
     577        id  = '/1' 
     578 
     579        # Leave only our one 
     580        aug.set(cfg + id + '/type', 'deb') 
     581        aug.set(cfg + id + '/uri',  self._ares.repo) 
     582        aug.set(cfg + id + '/distribution', self._ares.suite) 
     583        aug.set(cfg + id + '/component', 'main') 
     584 
     585# 
    544586# Postconfig 
    545587# 
     
    550592 
    551593    def setup(self): 
     594 
     595        # Do not log low-level kernel messages 
     596        cfg = self._ares.root + 'etc/init.d/klogd' 
     597        cmd = 'sed -i -e \'s|^KLOGD=.*|KLOGD="-c 4 -s"|g\' %s' % cfg 
     598        if os.system(cmd) != 0: 
     599            raise AresError('F: %s' % cmd) 
    552600 
    553601        # Stop here if we not running as root 
  • ares/trunk/tests/TestAres.py

    r797 r801  
    2828        ares.samba.setup() 
    2929        ares.nfs.setup() 
     30        ares.havp.setup() 
     31        ares.apt.setup() 
    3032        ares.aug.save() 
    3133        ares.postconfig.setup()