All pastes #17627 Raw Edit

Miscellany

public text v1 · immutable
#17627 ·published 2005-07-13 16:06 UTC
rendered paste body
    def checkMounts(self):
        """see if our shares are mounted. if not shout"""
        logType = "Mount" #to tell logwrite() what we're logging
        mounted = commands.getoutput("mount")
        listOfMounts = mounted.split("\n")
        #check our shares are mounted
        mountCount = 0
        mountsToLog = []
        for line in listOfMounts:
            if (line.find("/mnt/from_crocus")==0) or (line.find("/mnt/to_crocus")==0):
                print "GOT", line
                mountCount+=1
                mountsToLog.append(line)
        #we're looking for 2 mounts (/mnt/from_crocus and /mnt/to_crocus), so it's wrong if mountCount !=2
        if mountCount<2:
            self.logWrite("Error",["ERROR!! Not all mountpoints found"])
            return -1
        self.logWrite(logType, mountsToLog)
        return 0 #all ok!