Esempio n. 1
0
    def _process_cmd_sys_run_preload(self, resource_id, res_obj=None):
        fragments = []
        if get_arg("scenario"):
            scenario = get_arg("scenario")
            if scenario:
                from scion.process.preload.preloader import ScionLoader
                preloader = ScionLoader()
                preloader.container = Container.instance
                preloader.process = self.adminui
                preloader.CFG = dict(op="init")
                preloader.on_init()

                preloader.do_preload_master(scenario)
                fragments.append("Preload scenario '%s' executed.<br>OK" %
                                 scenario)
            else:
                fragments.append("Invalid arguments for scenario.")

        else:
            fragments.append("</pre><h2>Run Preload Scenario</h2>")
            fragments.append(
                "<form id='form_run_preload' action='%s' method='post'>" %
                _link('/cmd/sys_run_preload'))
            fragments.append("Scenario: <input name='scenario'><br>")
            fragments.append(
                "<input name='submit' type='submit' value='Run'><br>")
            fragments.append("</form>")
            fragments.append("<pre>")

        msg_text = "".join(fragments)
        return msg_text
Esempio n. 2
0
    def _process_cmd_sys_create_user(self, resource_id, res_obj=None):
        fragments = []
        if get_arg("email"):
            first, last, email, password = get_arg("first_name"), get_arg(
                "last_name"), get_arg("email"), get_arg("password")
            if first and last and email and password:
                sys_headers = get_system_actor_header()
                self.scion_client.define_user(None,
                                              first,
                                              last,
                                              email,
                                              password,
                                              email=email,
                                              headers=sys_headers)
                fragments.append("User '%s' created.<br>OK" % email)
            else:
                fragments.append("Invalid arguments to create user.")

        else:
            fragments.append("</pre><h2>Create User</h2>")
            fragments.append(
                "<form id='form_user_create' action='%s' method='post'>" %
                _link('/cmd/sys_create_user'))
            fragments.append("First name: <input name='first_name'><br>")
            fragments.append("Last name: <input name='last_name'><br>")
            fragments.append("Email: <input name='email' type='email'><br>")
            fragments.append(
                "Password: <input name='password' type='password'><br><br>")
            fragments.append(
                "<input name='submit' type='submit' value='Create'><br>")
            fragments.append("</form>")
            fragments.append("<pre>")

        msg_text = "".join(fragments)
        return msg_text
Esempio n. 3
0
    def _process_cmd_sys_create_user(self, resource_id, res_obj=None):
        fragments = []
        if get_arg("email"):
            first, last, email, password = get_arg("first_name"), get_arg("last_name"), get_arg("email"), get_arg(
                "password")
            if first and last and email and password:
                sys_headers = get_system_actor_header()
                self.scion_client.define_user(None, first, last, email, password, email=email, headers=sys_headers)
                fragments.append("User '%s' created.<br>OK" % email)
            else:
                fragments.append("Invalid arguments to create user.")

        else:
            fragments.append("</pre><h2>Create User</h2>")
            fragments.append("<form id='form_user_create' action='%s' method='post'>" % _link('/cmd/sys_create_user'))
            fragments.append("First name: <input name='first_name'><br>")
            fragments.append("Last name: <input name='last_name'><br>")
            fragments.append("Email: <input name='email' type='email'><br>")
            fragments.append("Password: <input name='password' type='password'><br><br>")
            fragments.append("<input name='submit' type='submit' value='Create'><br>")
            fragments.append("</form>")
            fragments.append("<pre>")

        msg_text = "".join(fragments)
        return msg_text
Esempio n. 4
0
    def _process_cmd_sys_run_preload(self, resource_id, res_obj=None):
        fragments = []
        if get_arg("scenario"):
            scenario = get_arg("scenario")
            if scenario:
                from scion.process.preload.preloader import ScionLoader
                preloader = ScionLoader()
                preloader.container = Container.instance
                preloader.process = self.adminui
                preloader.CFG = dict(op="init")
                preloader.on_init()

                preloader.do_preload_master(scenario)
                fragments.append("Preload scenario '%s' executed.<br>OK" % scenario)
            else:
                fragments.append("Invalid arguments for scenario.")

        else:
            fragments.append("</pre><h2>Run Preload Scenario</h2>")
            fragments.append("<form id='form_run_preload' action='%s' method='post'>" % _link('/cmd/sys_run_preload'))
            fragments.append("Scenario: <input name='scenario'><br>")
            fragments.append("<input name='submit' type='submit' value='Run'><br>")
            fragments.append("</form>")
            fragments.append("<pre>")

        msg_text = "".join(fragments)
        return msg_text