Changeset 797

Show
Ignore:
Timestamp:
09/06/08 13:49:42 (3 months ago)
Author:
free
Message:

Added _Nfs class

Location:
ares/trunk
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • ares/trunk/ares.py

    r795 r797  
    6262        self.fetchmail    = _Fetchmail(self) 
    6363        self.samba        = _Samba(self) 
     64        self.nfs          = _Nfs(self) 
    6465        self.postconfig   = _Postconfig(self) 
    6566 
     
    499500        aug.set(rec + '/directory mask', '0775') 
    500501 
     502        # Stop here if we not running as root 
     503        aug = self._ares.aug 
     504        if aug.get('/augeas/root') == 'fakeroot/': 
     505            return 
     506 
    501507        data = '/srv/data' 
     508 
    502509        if not os.path.exists(data): 
    503510            os.mkdir(data) 
     511 
    504512        os.chown(data, 0, grp.getgrnam('users')[2]) 
    505513        os.chmod(data,0775) 
     514 
    506515        cmd = 'chmod g+s %s' % data 
    507516        if os.system(cmd) != 0: 
    508517            raise AresError('F: %s' % cmd) 
     518 
     519# 
     520# Nfs 
     521# 
     522class _Nfs: 
     523 
     524    def __init__(self, ares): 
     525        self._ares = ares 
     526        self._cfg  = '/files/etc/exports' 
     527 
     528    def setup(self): 
     529 
     530        aug = self._ares.aug 
     531        cfg = self._cfg 
     532 
     533        dirs = [ aug.get(key) for key in aug.match(cfg + '/dir') ] 
     534        for dir in [ '/home', '/srv/data' ]: 
     535            if dir not in dirs: 
     536                key = cfg + '/dir[%d]' % (len(dirs)+1) 
     537                aug.set(key, dir) 
     538                aug.set(key + '/client', '*') 
     539                aug.set(key + '/client/option[1]', 'rw') 
     540                aug.set(key + '/client/option[2]', 'sync') 
     541                aug.set(key + '/client/option[3]', 'no_root_squash') 
    509542 
    510543# 
  • ares/trunk/tests/TestAres.py

    r795 r797  
    1414 
    1515    def test_ldap(self): 
    16         ares = Ares(test=False) 
     16        ares = Ares(test=True) 
    1717        ares.ldap.setup() 
    1818        ares.squid.setup() 
     
    2525        ares.amavis.setup() 
    2626        ares.spamassassin.setup() 
     27        ares.fetchmail.setup() 
    2728        ares.samba.setup() 
    28         ares.fetchmail.setup() 
     29        ares.nfs.setup() 
    2930        ares.aug.save() 
    3031        ares.postconfig.setup()