# 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):


import os
import stat
from clearstack import utils
from clearstack import validators
from clearstack.controller import Controller
from clearstack.argument import Argument
from clearstack.common import util
                     "format it with xfs. Leave blank to use a loop device",
                     "CONFIG_SWIFT_STORAGES",
                     '',
                     validators=[validate_storage]),
            Argument("swift-storage-zones",
                     "Number of Object Storage storage zones; this number "
                     "MUST be no larger than the number of configured "
                     "storage devices.",
                     "CONFIG_SWIFT_STORAGE_ZONES",
                     '1',
                     validators=[validators.digit]),
            Argument("swift-storage-replicas",
                     "Number of Object Storage storage replicas; this number "
                     "MUST be no larger than the number of configured "
                     "storage zones.",
                     "CONFIG_SWIFT_STORAGE_REPLICAS",
                     '1',
                     validators=[validators.digit]),
            Argument("swift-hash",
                     "Custom seed number to use for swift_hash_path_suffix in"
                     " /etc/swift/swift.conf. If you do not provide a value, "
                     "a seed number is automatically generated.",
                     "CONFIG_SWIFT_HASH",
                     utils.generate_random_pw(),
                     validators=[validators.not_empty]),
            Argument("swift-storage-size",
                     "Size of the Object Storage loopback file storage "
                     "device in GB",
                     "CONFIG_SWIFT_STORAGE_SIZE",
                     "2",

# 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/swift_600.py
import os
import stat
from clearstack import utils
from clearstack import validators
from clearstack.controller import Controller
from clearstack.argument import Argument
from clearstack.common import util

                     "format it with xfs. Leave blank to use a loop device",
                     "CONFIG_SWIFT_STORAGES",
                     '',
                     validators=[validate_storage]),
            Argument("swift-storage-zones",
                     "Number of Object Storage storage zones; this number "
                     "MUST be no larger than the number of configured "
                     "storage devices.",
                     "CONFIG_SWIFT_STORAGE_ZONES",
                     '1',
                     validators=[validators.digit]),
            Argument("swift-storage-replicas",
                     "Number of Object Storage storage replicas; this number "
                     "MUST be no larger than the number of configured "
                     "storage zones.",
                     "CONFIG_SWIFT_STORAGE_REPLICAS",
                     '1',
                     validators=[validators.digit]),
            Argument("swift-hash",
                     "Custom seed number to use for swift_hash_path_suffix in"
                     " /etc/swift/swift.conf. If you do not provide a value, "
                     "a seed number is automatically generated.",
                     "CONFIG_SWIFT_HASH",
                     utils.generate_random_pw(),
                     validators=[validators.not_empty]),
            Argument("swift-storage-size",
                     "Size of the Object Storage loopback file storage "
                     "device in GB",
                     "CONFIG_SWIFT_STORAGE_SIZE",
                     "2",

                     validators=[validators.digit]),