# Path: nuka/utils.py
# CHANGED = logging.WARNING + 1
# 
# Path: nuka/gpg.py
# class FileSystemLoader(jinja2.FileSystemLoader):
# 
#     def get_source(self, environment, template):
#         pieces = split_template_path(template)
#         for searchpath in self.searchpath:
#             filename = os.path.join(searchpath, *pieces)
#             f = open_if_exists(filename)
#             if f is None:
#                 continue
#             if filename.endswith('.gpg'):
#                 f.close()
#                 _, contents = decrypt(filename, self.encoding)
#             else:
#                 try:
#                     contents = f.read().decode(self.encoding)
#                 finally:
#                     f.close()
# 
#             mtime = os.path.getmtime(filename)
# 
#             def uptodate():
#                 try:
#                     return os.path.getmtime(filename) == mtime
#                 except OSError:
#                     return False
#             return contents, filename, uptodate
#         raise TemplateNotFound(template)


import tempfile
import logging
import os
import jinja2
import yaml
from nuka.utils import CHANGED
from nuka.gpg import FileSystemLoader

config['docker'] = {
    'use_api': False,
}

config['ssh'] = {
    'dirname': '{nuka_dir}/ssh',
    'options': [
       '-oControlMaster=auto',
       '-oControlPersist=300s',
       '-oControlPath={dirname}/%r@%h:%p',
    ],
}
config['connections'] = {'delay': .2}
config['log'] = {
    'dirname': '{nuka_dir}/logs',
    'stdout': '{nuka_dir}/logs/stdout.log',
    'formats': {
        'default': '%(levelname)-5.5s: %(message)s',
        'host': '%(levelname)-5.5s:{0.name:15.15}: %(message)s',
    },
    'levels': {
        'stream_level': CHANGED,
        'file_level': logging.INFO,
        'remote_level': logging.INFO,
    },
    'colors': {
        logging.ERROR: "\033[01;31m",
        logging.CRITICAL: "\033[01;31m",
        logging.WARN: "\033[01;35m",

# Path: nuka/utils.py
# CHANGED = logging.WARNING + 1
# 
# Path: nuka/gpg.py
# class FileSystemLoader(jinja2.FileSystemLoader):
# 
#     def get_source(self, environment, template):
#         pieces = split_template_path(template)
#         for searchpath in self.searchpath:
#             filename = os.path.join(searchpath, *pieces)
#             f = open_if_exists(filename)
#             if f is None:
#                 continue
#             if filename.endswith('.gpg'):
#                 f.close()
#                 _, contents = decrypt(filename, self.encoding)
#             else:
#                 try:
#                     contents = f.read().decode(self.encoding)
#                 finally:
#                     f.close()
# 
#             mtime = os.path.getmtime(filename)
# 
#             def uptodate():
#                 try:
#                     return os.path.getmtime(filename) == mtime
#                 except OSError:
#                     return False
#             return contents, filename, uptodate
#         raise TemplateNotFound(template)


# Path: nuka/configuration.py
import tempfile
import logging
import os
import jinja2
import yaml
from nuka.utils import CHANGED
from nuka.gpg import FileSystemLoader


config['docker'] = {
    'use_api': False,
}

config['ssh'] = {
    'dirname': '{nuka_dir}/ssh',
    'options': [
       '-oControlMaster=auto',
       '-oControlPersist=300s',
       '-oControlPath={dirname}/%r@%h:%p',
    ],
}
config['connections'] = {'delay': .2}
config['log'] = {
    'dirname': '{nuka_dir}/logs',
    'stdout': '{nuka_dir}/logs/stdout.log',
    'formats': {
        'default': '%(levelname)-5.5s: %(message)s',
        'host': '%(levelname)-5.5s:{0.name:15.15}: %(message)s',
    },
    'levels': {
        'stream_level': CHANGED,
        'file_level': logging.INFO,
        'remote_level': logging.INFO,
    },
    'colors': {
        logging.ERROR: "\033[01;31m",
        logging.CRITICAL: "\033[01;31m",
        logging.WARN: "\033[01;35m",

        CHANGED: "\033[01;35m",