def main(args=None): state = Configurer.read_state(args) c_args = Configurer.Struct(**state.get('args', args)) Configurer.enable_config(c_args.project_name) state['status'] = 'enabled' Configurer.write_state(state, c_args) pass
def install_with_template(args, name, template): state = { 'ts': time.time(), 'status': 'enabled', 'template_name': name, 'args': vars(args) } print("Preparing to initialize template, host is %s" % args.host) if template.TEMPLATE_TYPE == Template_Type.managed: state['template_type'] = 'managed' config = template.construct_config(args, shelf) Configurer.install_config(args.project_name) Configurer.set_config(args.project_name, config) Configurer.enable_config(args.project_name) elif template.TEMPLATE_TYPE == Template_Type.unmanaged: state['template_type'] = 'unmanaged' template.initialize(args, shelf) else: raise RuntimeError('Malformed template!') if getattr(template, 'post_install', None): state['has_post_install'] = True template.post_install(args, shelf) Configurer.write_state(state, args) shelf.sync()