Esempio n. 1
0
    DEFAULT_HELP,
    DEFAULT_TERMS,
    TRANSPORT_REST,
    DEFAULT_DETAILS,
    SUPPORTED_QUERY_TYPES,
    PARSED_RESPONSE_FIELDS,
    SUPPORTED_STRUCTURED_OUTPUT,
    __version__,
)
from hyperglass.exceptions import ConfigError, ConfigInvalid, ConfigMissing
from hyperglass.configuration.models import params as _params
from hyperglass.configuration.models import routers as _routers
from hyperglass.configuration.models import commands as _commands
from hyperglass.configuration.markdown import get_markdown

set_app_path(required=True)

CONFIG_PATH = Path(os.environ["hyperglass_directory"])
log.info("Configuration directory: {d}", d=str(CONFIG_PATH))

# Project Directories
WORKING_DIR = Path(__file__).resolve().parent
CONFIG_FILES = (
    ("hyperglass.yaml", False),
    ("devices.yaml", True),
    ("commands.yaml", False),
)


def _check_config_files(directory):
    """Verify config files exist and are readable.
Esempio n. 2
0
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
"""

# Standard Library
import logging

# Third Party
import uvloop

# Project
from hyperglass.log import _get_rich
from hyperglass.util import set_app_path
from hyperglass.constants import METADATA

# Set Rich as the default logging handler.
logging.getLogger().handlers = [_get_rich(True)]

# Find hyperglass application directory.
set_app_path()

# Use Uvloop for performance.
uvloop.install()

__name__, __version__, __author__, __copyright__, __license__ = METADATA