2017-02-06 15:38:22 +02:00

35 lines
1.2 KiB
Python

# Copyright 2017 Cloudbase Solutions Srl
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
"""
This is the single point of entry to generate the sample configuration
file for Cloudbase-Init.
"""
import collections
from hnv.config import base as config_base
from hnv.config import factory as config_factory
def get_options():
"""Collect all the options info from the other modules."""
options = collections.defaultdict(list)
for opt_class in config_factory.get_options():
if not issubclass(opt_class, config_base.Options):
continue
config_options = opt_class(None)
options[config_options.group_name].extend(config_options.list())
return [(key, value) for key, value in options.items()]