# Path: servi/exceptions.py
# class MasterNotFound(Exception):
#     def __init__(self):
#         pass
# 
#     def __str__(self):
#         return (
#             '\n***** ERROR *****\n'
#             'Master directory not found at or above current directory.\n'
#             'Looking for: <master>/ServiFile.yml\n'
#             'Above cwd: {0}\n'
#             'Run "servi init <dirname>"\n'
#             '\n**Servi Aborting**'.format(os.getcwd()))
# 
# class ServiError(Exception):
#     # Expected errrors. Handle gracefully (ie: no stack dump)
#     def __init__(self, msg=None):
#         self.msg = msg
# 
#     def __str__(self):
#         return (
#             '\n***** ERROR *****\n'
#             '{0}\n'
#             '\n**Servi Aborting**'.format(self.msg))


import os
import os.path
import logging
import collections
import yaml
from logging import warning as warn
from jinja2 import Environment, DictLoader
from servi.exceptions import MasterNotFound, ServiError
VERSION_FILE = "TEMPLATE_VERSION.json"
SERVIFILE = "Servifile.yml"
SERVIFILE_GLOBAL = "Servifile_globals.yml"
SERVIFILE_GLOBAL_FULL = os.path.expanduser(os.path.join('~', SERVIFILE_GLOBAL))

TEMPLATE = 'template'
MASTER = 'master'
MISSING_HASH = 'FILE NOT FOUND'

# The following must be set in Servifile.yml
SERVI_IGNORE_FILES = []
DIFFTOOL = 'git diff'

DEFAULT_LOG_LEVEL = logging.INFO

# Variables that should be set by Servifile.yml and Servifile_globals.yml
HOSTS = None
MAIN_USERNAME = None
MAIN_RSA_KEY_FILE = None
LOCAL_DIR = None
SITE_SUFFIX = None

#############################################################################
#############################################################################
#############################################################################
LOOKUP_FAILED_MESSAGE = 'Environment variable not found'


def lookup(ltype, arg1):
    if type(ltype) is not str or ltype.strip().lower() != 'env':

# Path: servi/exceptions.py
# class MasterNotFound(Exception):
#     def __init__(self):
#         pass
# 
#     def __str__(self):
#         return (
#             '\n***** ERROR *****\n'
#             'Master directory not found at or above current directory.\n'
#             'Looking for: <master>/ServiFile.yml\n'
#             'Above cwd: {0}\n'
#             'Run "servi init <dirname>"\n'
#             '\n**Servi Aborting**'.format(os.getcwd()))
# 
# class ServiError(Exception):
#     # Expected errrors. Handle gracefully (ie: no stack dump)
#     def __init__(self, msg=None):
#         self.msg = msg
# 
#     def __str__(self):
#         return (
#             '\n***** ERROR *****\n'
#             '{0}\n'
#             '\n**Servi Aborting**'.format(self.msg))


# Path: servi/config.py
import os
import os.path
import logging
import collections
import yaml
from logging import warning as warn
from jinja2 import Environment, DictLoader
from servi.exceptions import MasterNotFound, ServiError

VERSION_FILE = "TEMPLATE_VERSION.json"
SERVIFILE = "Servifile.yml"
SERVIFILE_GLOBAL = "Servifile_globals.yml"
SERVIFILE_GLOBAL_FULL = os.path.expanduser(os.path.join('~', SERVIFILE_GLOBAL))

TEMPLATE = 'template'
MASTER = 'master'
MISSING_HASH = 'FILE NOT FOUND'

# The following must be set in Servifile.yml
SERVI_IGNORE_FILES = []
DIFFTOOL = 'git diff'

DEFAULT_LOG_LEVEL = logging.INFO

# Variables that should be set by Servifile.yml and Servifile_globals.yml
HOSTS = None
MAIN_USERNAME = None
MAIN_RSA_KEY_FILE = None
LOCAL_DIR = None
SITE_SUFFIX = None

#############################################################################
#############################################################################
#############################################################################
LOOKUP_FAILED_MESSAGE = 'Environment variable not found'


def lookup(ltype, arg1):
    if type(ltype) is not str or ltype.strip().lower() != 'env':

        raise ServiError('Found "lookup" function that servi does not'