# Path: aeriscloud/config.py
# def module_path():
#     def __init__(self):
#     def load(self):
#     def has(self, section, option):
#     def get(self, section, option, **kwargs):
#     def set(self, section, option, value):
#     def unset(self, section, option):
#     def save(self):
#     def dump(self):
#     def complete(self):
# def inventory_path():
# def config_dir():
# def data_dir():
# def config_ini_path():
# def projects_path():
# def basebox_bucket():
# def default_organization():
# def expose_username():
# def expose_url():
# def has_github_integration():
# def verbosity(val=None):
# class Config(object):
# 
# Path: aeriscloud/log.py
# def get_logger(name=None, parent=_logger):
#     if name:
#         if not hasattr(parent, 'getChild'):
#             return parent.manager.getLogger('.'.join([parent.name, name]))
#         return parent.getChild(name)
#     return parent
# 
# Path: aeriscloud/utils.py
# def local_ip():
#     """
#     Retrieve the first ip from the interface linked to the default route
# 
#     :return str
#     """
#     sys_name = system()
#     if sys_name == 'Darwin':
#         # OSX
#         route = Command('route')
#         ifconfig = Command('ifconfig')
# 
#         iface = [
#             line.strip()
#             for line in route('-n', 'get', 'default')
#             if line.strip().startswith('interface')
#         ][0].split(':')[1].strip()
#         return [
#             line.strip()
#             for line in ifconfig(iface)
#             if line.strip().startswith('inet ')
#         ][0].split(' ')[1]
#     elif sys_name == 'Linux':
#         try:
#             ip = Command('ip')
#             iface = [
#                 line.strip()
#                 for line in ip('route')
#                 if line.strip().startswith('default ')
#             ][0].split(' ')[4]
#         except CommandNotFound:
#             route = Command('route')
#             iface = [
#                 line.strip()
#                 for line in route('-n')
#                 if line.startswith('0.0.0.0')
#             ][0].split(' ').pop()
# 
#         try:
#             # try with IP
#             ip = Command('ip')
#             return [
#                 line.strip()
#                 for line in ip('addr', 'show', iface)
#                 if line.strip().startswith('inet ')
#             ][0].split(' ')[1].split('/')[0]
#         except CommandNotFound:
#             pass
# 
#         # fallback to ifconfig
#         ifconfig = Command('ifconfig')
#         return [
#             line.strip()
#             for line in ifconfig(iface)
#             if line.strip().startswith('inet ')
#         ][0].split(' ')[1]
# 
#     return None


import json
import os
import sys
        import requests
from .config import config, expose_url, \
    configparser, data_dir
from .log import get_logger
from .utils import local_ip
        from requests.exceptions import Timeout, ConnectionError
        from requests.auth import HTTPBasicAuth



class ExposeError(RuntimeError):
    def __init__(self, e):
        super(RuntimeError, self).__init__(e.message)
        self.e = e


class ExposeTimeout(ExposeError):
    pass


class ExposeConnectionError(ExposeError):
    pass


class Expose(object):
    def __init__(self):
        self._config = configparser.SafeConfigParser()
        self._logger = get_logger('expose')


# Path: aeriscloud/config.py
# def module_path():
#     def __init__(self):
#     def load(self):
#     def has(self, section, option):
#     def get(self, section, option, **kwargs):
#     def set(self, section, option, value):
#     def unset(self, section, option):
#     def save(self):
#     def dump(self):
#     def complete(self):
# def inventory_path():
# def config_dir():
# def data_dir():
# def config_ini_path():
# def projects_path():
# def basebox_bucket():
# def default_organization():
# def expose_username():
# def expose_url():
# def has_github_integration():
# def verbosity(val=None):
# class Config(object):
# 
# Path: aeriscloud/log.py
# def get_logger(name=None, parent=_logger):
#     if name:
#         if not hasattr(parent, 'getChild'):
#             return parent.manager.getLogger('.'.join([parent.name, name]))
#         return parent.getChild(name)
#     return parent
# 
# Path: aeriscloud/utils.py
# def local_ip():
#     """
#     Retrieve the first ip from the interface linked to the default route
# 
#     :return str
#     """
#     sys_name = system()
#     if sys_name == 'Darwin':
#         # OSX
#         route = Command('route')
#         ifconfig = Command('ifconfig')
# 
#         iface = [
#             line.strip()
#             for line in route('-n', 'get', 'default')
#             if line.strip().startswith('interface')
#         ][0].split(':')[1].strip()
#         return [
#             line.strip()
#             for line in ifconfig(iface)
#             if line.strip().startswith('inet ')
#         ][0].split(' ')[1]
#     elif sys_name == 'Linux':
#         try:
#             ip = Command('ip')
#             iface = [
#                 line.strip()
#                 for line in ip('route')
#                 if line.strip().startswith('default ')
#             ][0].split(' ')[4]
#         except CommandNotFound:
#             route = Command('route')
#             iface = [
#                 line.strip()
#                 for line in route('-n')
#                 if line.startswith('0.0.0.0')
#             ][0].split(' ').pop()
# 
#         try:
#             # try with IP
#             ip = Command('ip')
#             return [
#                 line.strip()
#                 for line in ip('addr', 'show', iface)
#                 if line.strip().startswith('inet ')
#             ][0].split(' ')[1].split('/')[0]
#         except CommandNotFound:
#             pass
# 
#         # fallback to ifconfig
#         ifconfig = Command('ifconfig')
#         return [
#             line.strip()
#             for line in ifconfig(iface)
#             if line.strip().startswith('inet ')
#         ][0].split(' ')[1]
# 
#     return None


# Path: aeriscloud/expose.py
import json
import os
import sys
        import requests
from .config import config, expose_url, \
    configparser, data_dir
from .log import get_logger
from .utils import local_ip
        from requests.exceptions import Timeout, ConnectionError
        from requests.auth import HTTPBasicAuth




class ExposeError(RuntimeError):
    def __init__(self, e):
        super(RuntimeError, self).__init__(e.message)
        self.e = e


class ExposeTimeout(ExposeError):
    pass


class ExposeConnectionError(ExposeError):
    pass


class Expose(object):
    def __init__(self):
        self._config = configparser.SafeConfigParser()
        self._logger = get_logger('expose')


        if not os.path.isdir(data_dir()):