Logo Search packages:      
Sourcecode: bcfg2 version File versions  Download package

def lib::Client::Tools::POSIX::POSIX::VerifyDirectory (   self,
  entry,
  _ 
)

Verify Directory Entry

Definition at line 81 of file POSIX.py.

00081                                        :
        '''Verify Directory Entry'''
        while len(entry.get('perms', '')) < 4:
            entry.set('perms', '0' + entry.get('perms', ''))
        try:
            ondisk = os.stat(entry.get('name'))
        except OSError:
            entry.set('current_exists', 'false')
            self.logger.debug("%s %s does not exist" %
                              (entry.tag, entry.get('name')))
            return False
        try:
            owner = pwd.getpwuid(ondisk[ST_UID])[0]
            group = grp.getgrgid(ondisk[ST_GID])[0]
        except (OSError, KeyError):
            self.logger.error('User resolution failing')
            owner = 'root'
            group = 'root'
        perms = oct(os.stat(entry.get('name'))[ST_MODE])[-4:]
        if ((owner == entry.get('owner')) and
            (group == entry.get('group')) and
            (perms == entry.get('perms'))):
            return True
        else:
            if owner != entry.get('owner'):
                entry.set('current_owner', owner)
                self.logger.debug("%s %s ownership wrong" % (entry.tag, entry.get('name')))
            if group != entry.get('group'):
                entry.set('current_group', group)
                self.logger.debug("%s %s group wrong" % (entry.tag, entry.get('name')))
            if perms != entry.get('perms'):
                entry.set('current_perms', perms)
                self.logger.debug("%s %s permissions wrong: are %s should be %s" %
                               (entry.tag, entry.get('name'), perms, entry.get('perms')))
            return False

    def InstallDirectory(self, entry):


Generated by  Doxygen 1.6.0   Back to index