get rid of svn keywords once and for good
[plcapi.git] / PLC / Methods / DeleteConfFile.py
1 from PLC.Faults import *
2 from PLC.Method import Method
3 from PLC.Parameter import Parameter, Mixed
4 from PLC.ConfFiles import ConfFile, ConfFiles
5 from PLC.Auth import Auth
6
7 class DeleteConfFile(Method):
8     """
9     Returns an array of structs containing details about node
10     configuration files. If conf_file_ids is specified, only the
11     specified configuration files will be queried.
12     """
13
14     roles = ['admin']
15
16     accepts = [
17         Auth(),
18         ConfFile.fields['conf_file_id']
19         ]
20
21     returns = Parameter(int, '1 if successful')
22
23
24     def call(self, auth, conf_file_id):
25         conf_files = ConfFiles(self.api, [conf_file_id])
26         if not conf_files:
27             raise PLCInvalidArgument, "No such configuration file"
28
29         conf_file = conf_files[0]
30         conf_file.delete()
31         self.event_objects = {'ConfFile': [conf_file['conf_file_id']]}
32
33         return 1