4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at
8 # http://www.apache.org/licenses/LICENSE-2.0
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
16 from cmframework.apis import cmuserconfig
17 from cmframework.apis import cmerror
18 from cmdatahandlers.api import configerror
21 This plugin is used to add default values for auth_type and serverkeys_path parameters in user_config
22 if they are not present
24 class timehandler(cmuserconfig.CMUserConfigPlugin):
26 super(timehandler, self).__init__()
28 def handle(self, confman):
30 timeconf = confman.get_time_config_handler()
32 if 'auth_type' not in timeconf.config[ROOT]:
33 timeconf.config[ROOT]['auth_type'] = 'none'
34 if 'serverkeys_path' not in timeconf.config[ROOT]:
35 timeconf.config[ROOT]['serverkeys_path'] = ''
36 except configerror.ConfigError as exp:
37 raise cmerror.CMError(str(exp))