예제 #1
0
    def get_OS(self):
        oss = []

        for OS_node in self.host_node.getElementsByTagName('osclass'):
            os = OS.OS(OS_node)
            oss.append(os)

        for OS_node in self.host_node.getElementsByTagName('osmatch'):
            os = OS.OS(OS_node)
            oss.append(os)

        return oss
예제 #2
0
    def __init__(self, name, time_stamp, header=None):
        self._platform = Platform.Platform()
        self._os = OS.OS()
        self._name = name
        self._ERR_FILE_EXIST = "ERROR: Log file '%s' already exists" % name
        self._ERR_FILE_OPEN = "ERROR: Unable to open log file '%s'" % name
        
        if self._os.is_file(name):
            raise Error.Error(msg=self._ERR_FILE_EXIST)
        else:
            try:
                f = open(name, 'w')
            except IOError:
                raise Error.Error(msg=self._ERR_FILE_OPEN)
            
            if header != None:
                f.write("%s\n" % header)

            line = "Generated %s" % time_stamp.as_string()
            f.write(line+"\n\n")
            line = "System: %s" % self._platform.system()
            f.write(line+"\n")
            line = "Python version: %s" % self._platform.python_version()
            f.write(line+"\n")
            line = ("Python implementation: %s" 
                    % self._platform.python_implementation())
            f.write(line+"\n\n")
            f.close()
예제 #3
0
 def __init__(self):
     self._os = OS.OS()
     self._ts = TimeStamp.TimeStamp()
     self._existing_log_file = "mocks/test.log"
예제 #4
0
 def __init__(self):
     self._os = OS.OS()
     self._existing_file = "mocks/test.log"
     self._non_existing_file = "mocks/non_existing_file"