# Path: clearstack/utils.py
# def arg(*args, **kwargs):
#     def _decorator(func):
# def run_recipe(recipe_file, recipe_src, hosts):
# def _run_recipe_local(recipe_file):
# def _run_recipe_in_hosts(recipe_file, recipes_dir, _hosts):
# def get_all_hosts():
# def generate_conf_file(conf_file):
# def copy_resources():
# def _copy_resources_local():
# def _copy_resources_to_hosts(_hosts):
# def get_logs():
# def get_template(template):
# def generate_random_pw():
# def generate_ssh_keys(output):
# def setup_debugging(debug):
# 
# Path: clearstack/validators.py
# def y_or_n(value):
# def ip_or_hostname(value):
# def cidr(value):
# def file(value):
# def not_empty(value):
# def digit(value):
# 
# Path: clearstack/controller.py
# class Controller:
#     CONF = {}
#     _plugins = []
#     _groups = []
#     _sequences = []
# 
#     def add_sequence(self, desc, function, args=None):
#         self._sequences.append(Sequence(desc, function, args))
# 
#     def run_all_sequences(self):
#         for seq in self._sequences:
#             try:
#                 seq.run()
#             except Exception as e:
#                 raise e
# 
#     def add_plugin(self, plugin):
#         self._plugins.append(plugin)
# 
#     def get_all_plugins(self):
#         return self._plugins
# 
#     def add_group(self, name, args):
#         self._groups.append(Group(name, args))
# 
#     def get_all_groups(self):
#         return self._groups
# 
#     def get_all_arguments(self):
#         """Get a list of the configuration argument loaded"""
#         arguments = []
#         for group in self._groups:
#             arguments.extend([argument.conf_name
#                               for argument in group.get_all_arguments()])
#         return arguments
# 
#     def validate_groups(self, conf_values):
#         """ Load validation functions, in order to check
#         the values in the answer file """
#         arguments = {}
#         for group in self._groups:
#             for arg in group.get_all_arguments():
#                 try:
#                     arg.validate(conf_values[arg.conf_name])
#                 except Exception as e:
#                     raise Exception("{0}: {1}".format(arg.conf_name, str(e)))
#         return arguments
# 
# Path: clearstack/argument.py
# class Argument(object):
#     def __init__(self, cmd_option, description,
#                  conf_name, default_value, validators=[],
#                  options=None):
#         self.cmd_option = cmd_option
#         self.description = description
#         self.conf_name = conf_name
#         self.default_value = default_value
#         self.validators = validators
#         self.option_list = options
# 
#     def validate(self, option):
#         for validator in self.validators:
#             try:
#                 validator(option)
#             except ValueError as e:
#                 raise ValueError("{0}: {1}".format(self.conf_name, str(e)))
# 
# Path: clearstack/common/util.py
# HOST_LOG_DIR = '/var/log/clearstack'
# HOST_LOG_FILE = "{0}/clearstack.log".format(HOST_LOG_DIR)
# LOG_DIR = '/var/log/clearstack'
#     LOG_DIR = '/tmp/log/clearstack'
# LOG_FILE = "{0}/clearstack.log".format(LOG_DIR)
# LOG = logging.getLogger("Clearstack")
# def _print_error_message(self, e, file_name):
# def port_open(port):
# def service_status(service):
# def service_enabled(service):
# def setup_debugging(debug, is_remote_host=True):
# def run_command(command, stdin=None, environ=None, debug=True):
# def str2bool(value):
# def write_config(file, data):
# def write_properties(file, data):
# def get_option(file, section, option):
# def delete_option(file, section, option=None):
# def write_in_file_ine(file, data):
# def get_dns():
# def get_netmask():
# def get_gateway():
# def get_net_interface():
# def get_ips():
# def get_nic(ip):
# def get_ip():
# def find_my_ip_from_config(config_ips):
# def is_localhost(host):
# def has_localhost(hosts):
# def remove_localhost(hosts):
# def ensure_directory(dir):
# def link_file(source, target):


from clearstack import utils
from clearstack import validators
from clearstack.controller import Controller
from clearstack.argument import Argument
from clearstack.common import util
# Author: Julio Montes <julio.montes@intel.com>
#
# 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.
#



def init_config():
    conf = {
        "NOVA": [
            Argument("nova-db-pw",
                     "Password for nova to access DB",
                     "CONFIG_NOVA_DB_PW",
                     utils.generate_random_pw(),
                     validators=[validators.not_empty]),
            Argument("nova-ks-pw",
                     "Password to use for the Nova to"
                     " authenticate with Keystone",
                     "CONFIG_NOVA_KS_PW",
                     utils.generate_random_pw(),

# Path: clearstack/utils.py
# def arg(*args, **kwargs):
#     def _decorator(func):
# def run_recipe(recipe_file, recipe_src, hosts):
# def _run_recipe_local(recipe_file):
# def _run_recipe_in_hosts(recipe_file, recipes_dir, _hosts):
# def get_all_hosts():
# def generate_conf_file(conf_file):
# def copy_resources():
# def _copy_resources_local():
# def _copy_resources_to_hosts(_hosts):
# def get_logs():
# def get_template(template):
# def generate_random_pw():
# def generate_ssh_keys(output):
# def setup_debugging(debug):
# 
# Path: clearstack/validators.py
# def y_or_n(value):
# def ip_or_hostname(value):
# def cidr(value):
# def file(value):
# def not_empty(value):
# def digit(value):
# 
# Path: clearstack/controller.py
# class Controller:
#     CONF = {}
#     _plugins = []
#     _groups = []
#     _sequences = []
# 
#     def add_sequence(self, desc, function, args=None):
#         self._sequences.append(Sequence(desc, function, args))
# 
#     def run_all_sequences(self):
#         for seq in self._sequences:
#             try:
#                 seq.run()
#             except Exception as e:
#                 raise e
# 
#     def add_plugin(self, plugin):
#         self._plugins.append(plugin)
# 
#     def get_all_plugins(self):
#         return self._plugins
# 
#     def add_group(self, name, args):
#         self._groups.append(Group(name, args))
# 
#     def get_all_groups(self):
#         return self._groups
# 
#     def get_all_arguments(self):
#         """Get a list of the configuration argument loaded"""
#         arguments = []
#         for group in self._groups:
#             arguments.extend([argument.conf_name
#                               for argument in group.get_all_arguments()])
#         return arguments
# 
#     def validate_groups(self, conf_values):
#         """ Load validation functions, in order to check
#         the values in the answer file """
#         arguments = {}
#         for group in self._groups:
#             for arg in group.get_all_arguments():
#                 try:
#                     arg.validate(conf_values[arg.conf_name])
#                 except Exception as e:
#                     raise Exception("{0}: {1}".format(arg.conf_name, str(e)))
#         return arguments
# 
# Path: clearstack/argument.py
# class Argument(object):
#     def __init__(self, cmd_option, description,
#                  conf_name, default_value, validators=[],
#                  options=None):
#         self.cmd_option = cmd_option
#         self.description = description
#         self.conf_name = conf_name
#         self.default_value = default_value
#         self.validators = validators
#         self.option_list = options
# 
#     def validate(self, option):
#         for validator in self.validators:
#             try:
#                 validator(option)
#             except ValueError as e:
#                 raise ValueError("{0}: {1}".format(self.conf_name, str(e)))
# 
# Path: clearstack/common/util.py
# HOST_LOG_DIR = '/var/log/clearstack'
# HOST_LOG_FILE = "{0}/clearstack.log".format(HOST_LOG_DIR)
# LOG_DIR = '/var/log/clearstack'
#     LOG_DIR = '/tmp/log/clearstack'
# LOG_FILE = "{0}/clearstack.log".format(LOG_DIR)
# LOG = logging.getLogger("Clearstack")
# def _print_error_message(self, e, file_name):
# def port_open(port):
# def service_status(service):
# def service_enabled(service):
# def setup_debugging(debug, is_remote_host=True):
# def run_command(command, stdin=None, environ=None, debug=True):
# def str2bool(value):
# def write_config(file, data):
# def write_properties(file, data):
# def get_option(file, section, option):
# def delete_option(file, section, option=None):
# def write_in_file_ine(file, data):
# def get_dns():
# def get_netmask():
# def get_gateway():
# def get_net_interface():
# def get_ips():
# def get_nic(ip):
# def get_ip():
# def find_my_ip_from_config(config_ips):
# def is_localhost(host):
# def has_localhost(hosts):
# def remove_localhost(hosts):
# def ensure_directory(dir):
# def link_file(source, target):


# Path: clearstack/plugins/nova_400.py
from clearstack import utils
from clearstack import validators
from clearstack.controller import Controller
from clearstack.argument import Argument
from clearstack.common import util

# Author: Julio Montes <julio.montes@intel.com>
#
# 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.
#



def init_config():
    conf = {
        "NOVA": [
            Argument("nova-db-pw",
                     "Password for nova to access DB",
                     "CONFIG_NOVA_DB_PW",
                     utils.generate_random_pw(),
                     validators=[validators.not_empty]),
            Argument("nova-ks-pw",
                     "Password to use for the Nova to"
                     " authenticate with Keystone",
                     "CONFIG_NOVA_KS_PW",
                     utils.generate_random_pw(),

                     validators=[validators.not_empty])