Example #1
0
    def _finalize_init(self, mode, options):
        # When in 'all' mode configure the database.
        if mode == 'all':
            perform_work('Initializing database', init_db)

        # Configure mode.
        def start_services():
            render_supervisord(mode)
            set_current_mode(mode)
            sighup_supervisord()

        perform_work(
            'Starting services' if mode != 'none' else 'Stopping services',
            start_services)

        if mode == 'all':
            # When in 'all' mode configure the database and create admin user.
            perform_work('Waiting for postgresql', wait_for_postgresql)
            perform_work("Performing database migrations",
                         migrate_db,
                         capture=sys.stdout.isatty())
            clear_line()
            init_maas(options)
        elif mode in ['region', 'region+rack']:
            # When in 'region' or 'region+rack' the migrations for the database
            # must be at the same level as this controller.
            perform_work("Performing database migrations",
                         migrate_db,
                         capture=sys.stdout.isatty())
        else:
            clear_line()
Example #2
0
    def _finalize_init(self, mode, options):
        # When in 'all' mode configure the database.
        if mode == "all":
            perform_work("Initializing database", init_db)

        # Configure mode.
        def start_services():
            render_supervisord(mode)
            set_current_mode(mode)
            sighup_supervisord()

        perform_work(
            "Starting services" if mode != "none" else "Stopping services",
            start_services,
        )

        if mode == "all":
            # When in 'all' mode configure the database and create admin user.
            perform_work("Waiting for postgresql", wait_for_postgresql)
            perform_work(
                "Performing database migrations",
                migrate_db,
                capture=sys.stdout.isatty(),
            )
            init_maas(options)
        elif mode in ["region", "region+rack"]:
            # When in 'region' or 'region+rack' the migrations for the database
            # must be at the same level as this controller.
            perform_work(
                "Performing database migrations",
                migrate_db,
                capture=sys.stdout.isatty(),
            )
            print_msg(
                dedent("""\
                    MAAS has been set up.

                    If you want to configure external authentication or use
                    MAAS with Canonical RBAC, please run

                      sudo maas configauth

                    To create admins when not using external authentication, run

                      sudo maas createadmin
                    """))
Example #3
0
File: cli.py Project: zeronewb/maas
 def __call__(self, options):
     init_maas(options)