2 from PLC.Faults import *
3 from PLC.Method import Method
4 from PLC.Parameter import Parameter, Mixed
5 from PLC.ConfFiles import ConfFile, ConfFiles
6 from PLC.Auth import Auth
8 can_update = lambda (field, value): field not in \
9 ['conf_file_id', 'node_ids', 'nodegroup_ids']
11 class AddConfFile(Method):
13 Adds a new node configuration file. Any fields specified in
14 conf_file_fields are used, otherwise defaults are used.
16 Returns the new conf_file_id (> 0) if successful, faults otherwise.
21 conf_file_fields = dict(filter(can_update, ConfFile.fields.items()))
28 returns = Parameter(int, 'New conf_file_id (> 0) if successful')
31 def call(self, auth, conf_file_fields):
32 conf_file_fields = dict(filter(can_update, conf_file_fields.items()))
33 conf_file = ConfFile(self.api, conf_file_fields)
36 self.event_objects = {'ConfFile': [conf_file['conf_file_id']]}
38 return conf_file['conf_file_id']