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

def lib::Client::Frame::Frame::GenerateStats (   self  ) 

Generate XML summary of execution statistics

Definition at line 187 of file Frame.py.

00187                            :
        '''Generate XML summary of execution statistics'''
        feedback = Bcfg2.Client.XML.Element("upload-statistics")
        stats = Bcfg2.Client.XML.SubElement(feedback, \
                                            'Statistics', total=str(len(self.states)),
                                            client_version=__revision__, version='2.0',
                                            revision=self.config.get('revision', '-1'))
        good = len([key for key, val in self.states.iteritems() if val])
        stats.set('good', str(good))
        if len([key for key, val in self.states.iteritems() if not val]) == 0:
            stats.set('state', 'clean')
            stats.set('state', 'dirty')

        # List bad elements of the configuration
        for (data, ename) in [(self.modified, 'Modified'), (self.extra, "Extra"), \
                              ([entry for entry in self.states if not \
                                self.states[entry]], "Bad")]:
            container = Bcfg2.Client.XML.SubElement(stats, ename)
            [container.append(item) for item in data]

        timeinfo = Bcfg2.Client.XML.Element("OpStamps")
        for (event, timestamp) in self.times.iteritems():
            timeinfo.set(event, str(timestamp))
        return feedback
        return feedback

Generated by  Doxygen 1.6.0   Back to index