#!/usr/bin/env python3
# Copyright 2017 Canonical Ltd.  This software is licensed under the
# GNU Affero General Public License version 3 (see the file LICENSE).

import os
import sys
import maascli


def run():
    # Allow maas-region to work in a snap.
    os.environ.setdefault(
        "DJANGO_SETTINGS_MODULE", "maasserver.djangosettings.snappy")
    os.environ.setdefault("MAAS_PATH", os.environ.get("SNAP"))
    os.environ.setdefault("MAAS_ROOT", os.environ.get("SNAP_DATA"))
    os.environ.setdefault(
        "MAAS_REGION_CONFIG",
        os.path.join(os.environ.get("SNAP_DATA"), "regiond.conf"))

    import maascli
    return maascli.main()


sys.exit(run())
