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

def auditd_config::AuditdConfig::write (   self,
  client 
)

Write current state to the auditd configuration file using client.

Raise IOError on error, ValueError on invalid configuration.

Definition at line 370 of file auditd_config.py.

00370                            :
        '''Write current state to the auditd configuration file using client.

        Raise IOError on error, ValueError on invalid configuration.

        '''
        (vals, vals2) = self.__option_values()
        used = {}
        for var in vals.iterkeys():
            used[var] = False

        lines = []
        old_contents = client.read_file(server.FILE_AUDITD_CONF)
        for line in old_contents.splitlines():
            lines.append(self.__updated_line(vals, vals2, used, line))

        for var in vals.iterkeys():
            if not used[var]:
                val2 = vals2.get(var)
                if val2 is not None:
                    lines.append('%s = %s %s' % (var, vals[var], val2))
                else:
                    lines.append('%s = %s' % (var, vals[var]))

        contents = '\n'.join(lines)
        if len(contents) != 0:
            contents = contents + '\n'
        client.write_file(server.FILE_AUDITD_CONF, contents)

    def __eq__(self, config):


Generated by  Doxygen 1.6.0   Back to index