3 from PLC.Faults import *
4 from PLC.Method import Method
5 from PLC.Parameter import Parameter, Mixed
6 from PLC.ConfFiles import ConfFile, ConfFiles
7 from PLC.Auth import Auth
9 can_update = lambda (field, value): field not in \
10 ['conf_file_id', 'node_ids', 'nodegroup_ids']
12 class AddConfFile(Method):
14 Adds a new node configuration file. Any fields specified in
15 conf_file_fields are used, otherwise defaults are used.
17 Returns the new conf_file_id (> 0) if successful, faults otherwise.
22 conf_file_fields = dict(filter(can_update, ConfFile.fields.items()))
29 returns = Parameter(int, 'New conf_file_id (> 0) if successful')
32 def call(self, auth, conf_file_fields):
33 conf_file_fields = dict(filter(can_update, conf_file_fields.items()))
34 conf_file = ConfFile(self.api, conf_file_fields)
37 self.event_objects = {'ConfFile': [conf_file['conf_file_id']]}
39 return conf_file['conf_file_id']