def __safe_call__(self):
        box = CTK.Box()
        pre = "tmp!market!install"
        root = CTK.cfg.get_val('%s!root' % (pre))
        path = os.path.join(root, 'wp-es')

        # If only default language present, skip stage
        if not os.path.isdir(path):
            box += CTK.RawHTML(
                js=CTK.DruidContent__JS_to_goto(box.id, URL_DATABASE))
            return box.Render().toStr()

        table = CTK.PropsTable()
        table.Add(
            _('Language'),
            CTK.ComboCfg('%s!wordpress!lang' % (pre), OPTS_LANG, {
                'class': 'noauto',
                'selected': 'en'
            }), _(LANG_NOTE))

        submit = CTK.Submitter(URL_APPLY)
        submit += table
        submit.bind('submit_success',
                    CTK.DruidContent__JS_to_goto(table.id, URL_DATABASE))

        buttons = CTK.DruidButtonsPanel()
        buttons += CTK.DruidButton_Close(_('Cancel'))
        buttons += CTK.DruidButton_Submit(_('Next'), do_close=False)

        box = CTK.Box()
        box += CTK.RawHTML('<h2>%s</h2>' % (LANG_H2))
        box += CTK.RawHTML('<p>%s</p>' % (LANG_P1))
        box += submit
        box += buttons
        return box.Render().toStr()
Ejemplo n.º 2
0
    def __init__(self, refresh):
        CTK.Box.__init__(self)

        self += CTK.RawHTML('<h2>%s</h2>' % (_(NOTE_NAGIOSUSER_H)))
        self += CTK.RawHTML('<p>%s</p>' % (_(NOTE_NAGIOSUSER_P)))
        self += Method_Chooser(refresh)

        method = CTK.cfg.get_val('%s!nagiosmethod' % (PRE))

        if method == 'automatic':
            widget = Method_Auto()
            widget.bind(
                'goto_next_stage',
                CTK.DruidContent__JS_to_goto(self.id, URL_USER_CREATION))

        else:
            widget = Method_Manual()
            widget.bind(
                'goto_next_stage',
                CTK.DruidContent__JS_to_goto(self.id, URL_SERVER_BUILD))

        buttons = CTK.DruidButtonsPanel()
        buttons += CTK.DruidButton_Close(_('Cancel'))
        buttons += CTK.DruidButton_Submit(_('Next'), do_close=False)
        self += widget
        self += buttons
Ejemplo n.º 3
0
    def __call__(self):
        # Form
        submit = CTK.Submitter(URL_SAVE_APPLY)
        submit += CTK.TextArea({
            'name':
            'comment',
            'class':
            'noauto backup-notes-textarea optional',
            'style':
            'width: 436px; height: 48px; margin-top: 8px;'
        })
        submit.bind('submit_success',
                    CTK.DruidContent__JS_to_goto(submit.id, URL_SAVE_SUCCESS))
        submit.bind('submit_fail',
                    CTK.DruidContent__JS_to_goto(submit.id, URL_SAVE_FAIL))

        # Buttons
        panel = CTK.DruidButtonsPanel()
        panel += CTK.DruidButton_Close(_('Cancel'))
        panel += CTK.DruidButton_Submit(_('Back Up'))

        # Layout
        content = CTK.Container()
        content += CTK.RawHTML('<p>%s</p>' % (_(NOTE_SAVE_P1)))
        content += CTK.RawHTML('<p>%s</p>' % (_(NOTE_SAVE_P2)))
        box = CTK.Box()
        box += CTK.RawHTML("<strong>%s</strong>" % (_("Notes")))
        box += submit
        content += box
        content += panel

        return content.Render().toStr()
Ejemplo n.º 4
0
    def __call__(self):
        application_id = CTK.request.url.split('/')[-1]

        # Build the content
        submit = CTK.Submitter(URL_REPORT_APPLY)
        submit += CTK.TextArea({
            'name': 'report',
            'rows': 10,
            'cols': 60,
            'class': 'noauto'
        })
        submit += CTK.Hidden('app_id', application_id)
        submit.bind('submit_fail',
                    CTK.DruidContent__JS_to_goto(submit.id, URL_REPORT_FAIL))
        submit.bind('submit_success',
                    CTK.DruidContent__JS_to_goto(submit.id, URL_REPORT_OK))

        cont = CTK.Container()
        cont += CTK.RawHTML("<h2>%s</h2>" % (_(NOTE_REPORT_H2)))
        cont += CTK.RawHTML("<p>%s</p>" % (_(NOTE_REPORT_EXPLAIN)))
        cont += CTK.RawHTML("<p>%s</p>" % (_(NOTE_REPORT_COMMENT)))
        cont += submit

        buttons = CTK.DruidButtonsPanel()
        buttons += CTK.DruidButton_Submit(_("Report"))
        buttons += CTK.DruidButton_Close(_("Cancel"))
        cont += buttons

        return cont.Render().toStr()
Ejemplo n.º 5
0
    def __call__(self):
        # Check the application
        db_type = None
        db_found = False

        for app in CTK.cfg.keys('tmp!market!maintenance!remove'):
            tmp = CTK.cfg.get_val('tmp!market!maintenance!remove!%s!db' %
                                  (app))
            if not tmp:
                continue

            if not CTK.cfg.get_val('tmp!market!maintenance!db!%s!user' %
                                   (tmp)):
                db_found = True
                db_type = tmp

        # No DBs, we are done here
        if not db_found:
            box = CTK.Box()
            box += CTK.RawHTML(js=CTK.DruidContent__JS_to_goto(
                box.id, URL_MAINTENANCE_REMOVE))
            return box.Render().toStr()

        # Ask for the user and password
        table = CTK.PropsTable()
        table.Add(
            _('DB user'),
            CTK.TextField({
                'name': 'db_user',
                'class': 'noauto',
                'value': 'root'
            }), _(NOTE_DBUSER))
        table.Add(
            _('DB password'),
            CTK.TextFieldPassword({
                'name': 'db_pass',
                'class': 'noauto'
            }), _(NOTE_DBPASS))

        # Reload its content on submit success
        submit = CTK.Submitter(URL_MAINTENANCE_DB_APPLY)
        submit.bind('submit_success',
                    CTK.DruidContent__JS_to_goto(table.id, URL_MAINTENANCE_DB))
        submit += CTK.Hidden('db_type', db_type)
        submit += table

        cont = CTK.Container()
        cont += CTK.RawHTML('<h2>%s (%s)</h2>' %
                            (_("Database Credentials"), db_type))
        cont += CTK.RawHTML('<p>%s</p>' % (_(DB_DEL_P1)))
        cont += submit

        return cont.Render().toStr()
Ejemplo n.º 6
0
    def __safe_call__(self):
        nagiosuser = CTK.cfg.get_val('%s!nagiosuser' % (PRE))
        nagiosgroup = CTK.cfg.get_val('%s!nagiosgroup' % (PRE))
        nagioscmd = CTK.cfg.get_val('%s!nagioscmd' % (PRE))
        root = CTK.cfg.get_val('%s!root' % (PRE))

        box = CTK.Box()
        box += CTK.RawHTML('<h2>%s</h2>' % (_("Checking System Users")))

        # Installation
        ret = tools.create_credentials(nagiosuser, nagiosgroup, nagioscmd,
                                       root)

        if ret.get('ret') == True:
            box += CTK.RawHTML(
                js=CTK.DruidContent__JS_to_goto(box.id, URL_SERVER_BUILD))
            return box.Render().toStr()

        box += CTK.RawHTML('<p>%s</p>' % (ret['error']))
        box += CTK.Notice(content=CTK.RawHTML('<p>%s</p><pre>%s</pre>' % (_(
            'The installer could not successfully execute the following command:'
        ), ret['command'])))
        box += CTK.RawHTML('<p>%s</p><pre>%s</pre>' %
                           (_('The reported error was:'), ret['stderr']))

        buttons = CTK.DruidButtonsPanel()
        buttons += CTK.DruidButton_Close(_('Cancel'))
        buttons += CTK.DruidButton_Goto(_('Retry'),
                                        URL_USER_CREATION,
                                        do_submit=True)
        box += buttons

        return box.Render().toStr()
Ejemplo n.º 7
0
    def __safe_call__(self):
        box = CTK.Box()
        buttons = CTK.DruidButtonsPanel()

        pre = "tmp!market!install"
        submit = CTK.Submitter(URL_APPLY)
        table = CTK.PropsTable()
        table.Add(_('Trac User'),
                  CTK.TextCfg('%s!user' % (pre), False, {'class': 'noauto'}),
                  _(NOTE_USER))
        table.Add(
            _('Trac Password'),
            CTK.TextCfg('%s!password' % (pre), False, {'class': 'noauto'}),
            _(NOTE_PASSWORD))
        submit += table
        submit.bind('submit_success',
                    CTK.DruidContent__JS_to_goto(box.id, URL_SERVER_CONFIG))

        box += CTK.RawHTML('<h2>%s</h2>' % (_(NOTE_AUTHLIST_H)))
        box += CTK.RawHTML('<p>%s</p>' % (_(NOTE_AUTHLIST_P)))
        box += submit

        buttons += CTK.DruidButton_Close(_('Cancel'))
        buttons += CTK.DruidButton_Submit(_('Next'), do_close=False)
        box += buttons

        return box.Render().toStr()
Ejemplo n.º 8
0
    def __safe_call__(self):
        ruby_min = ruby.ruby_version()

        db_supported = DB_SUPPORTED[:]

        if version_to_int (ruby_min) < version_to_int ('1.8.6') or \
                not database.mysql_dev_path(): # required by mysql gem:
            db_supported.remove('mysql')

        if version_to_int(ruby_min) < version_to_int(
                '1.8.7'):  # required by sqlite3 gem:
            db_supported.remove('sqlite3')

        box = CTK.Box()
        db_widget = database.MethodSelection(db_supported)
        db_widget.bind('goto_next_stage',
                       CTK.DruidContent__JS_to_goto(box.id, URL_LANGUAGE))

        buttons = CTK.DruidButtonsPanel()
        buttons += CTK.DruidButton_Close(_('Cancel'))
        buttons += CTK.DruidButton_Submit(_('Next'), do_close=False)

        box += db_widget
        box += buttons
        return box.Render().toStr()
Ejemplo n.º 9
0
    def __safe_call__ (self):
        box = CTK.Box()
        box += CTK.RawHTML ('<h2>%s</h2>' %(_("Checking Requirements")))

        buttons = CTK.DruidButtonsPanel()
        buttons += CTK.DruidButton_Close(_('Cancel'))
        buttons += CTK.DruidButton_Goto (_('Retry'), URL_PRECONDITION, do_submit=True)

        # Check PHP
        php_cgi_bin = php.figure_phpcgi_binary()

        if not php_cgi_bin:
            box += php.PHP_Interpreter_Not_Found_Widget()
            box += buttons
            return box.Render().toStr()

        # Check at least one php DB module is available
        db_errors = tools.check_php_database_support()
        if db_errors:
            note, instruction_list = db_errors

            box += market.Util.InstructionBox (note, instruction_list, bin_path=php_cgi_bin)
            box += buttons
            return box.Render().toStr()

        # Database
        supported_dbs = database.get_supported_dbs (DB_SUPPORTED)
        if not supported_dbs:
            box += database.PreconditionError (DB_SUPPORTED)
            box += buttons
            return box.Render().toStr()

        box += CTK.RawHTML (js = CTK.DruidContent__JS_to_goto (box.id, URL_TARGET))
        return box.Render().toStr()
Ejemplo n.º 10
0
    def __safe_call__(self):
        Install_Log.log("Post unpack commands")

        target_path = CTK.cfg.get_val('tmp!market!install!root')
        app_name = CTK.cfg.get_val('tmp!market!install!app!application_name')

        # Import the Installation handler
        if os.path.exists(os.path.join(target_path, "installer.py")):
            Install_Log.log("Passing control to installer.py")
            installer_path = os.path.join(target_path, "installer.py")
            pkg_installer = imp.load_source('installer', installer_path)
        else:
            Install_Log.log("Passing control to installer.pyo")
            installer_path = os.path.join(target_path, "installer.pyo")
            pkg_installer = imp.load_compiled('installer', installer_path)

        # GUI
        box = CTK.Box()

        commands = pkg_installer.__dict__.get('POST_UNPACK_COMMANDS', [])
        if not commands:
            box += CTK.RawHTML(js=CTK.DruidContent__JS_to_goto(
                box.id, URL_INSTALL_SETUP_EXTERNAL))
            return box.Render().toStr()

        box += CTK.RawHTML("<h2>%s %s</h2>" % (_("Installing"), app_name))
        box += CTK.RawHTML("<p>%s</p>" % (_("Setting it up…")))

        progress = CommandProgress.CommandProgress(commands,
                                                   URL_INSTALL_SETUP_EXTERNAL)
        box += progress
        return box.Render().toStr()
    def __safe_call__(self):
        box = CTK.Box()
        box += CTK.RawHTML('<h2>%s</h2>' % (_("Checking Dependencies")))

        error_cc = tools.check_cc()
        error_py = python.detect_python("2.5.0", or_greater=True)
        error_xml = tools.check_xml2config()

        if error_cc:
            note, inst = error_cc
        elif error_py:
            note, inst = error_py
        elif error_xml:
            note, inst = error_xml
        else:
            box += CTK.RawHTML(
                js=CTK.DruidContent__JS_to_goto(box.id, URL_TARGET))
            return box.Render().toStr()

        box += market.Util.InstructionBox(_(note), inst)
        buttons = CTK.DruidButtonsPanel()
        buttons += CTK.DruidButton_Close(_('Cancel'))
        buttons += CTK.DruidButton_Goto(_('Retry'),
                                        URL_PRECONDITION,
                                        do_submit=True)
        return box.Render().toStr()
    def __safe_call__(self):
        box = CTK.Box()
        pre = 'tmp!market!install'

        # Replacements
        app_id = CTK.cfg.get_val('%s!app!application_id' % (pre))
        app_name = CTK.cfg.get_val('%s!app!application_name' % (pre))
        root = CTK.cfg.get_val('%s!root' % (pre))
        target_type = CTK.cfg.get_val('%s!target' % (pre))
        target_vserver = CTK.cfg.get_val('%s!target!vserver' % (pre))
        target_vserver_n = CTK.cfg.get_val('%s!target!vserver_n' % (pre))
        target_directory = CTK.cfg.get_val('%s!target!directory' % (pre))
        pre_vsrv = 'vserver!%s' % (target_vserver_n)

        # PHP info
        php_info = php.get_info(pre_vsrv)

        # More replacements
        props = cfg_get_surrounding_repls('pre_rule', php_info['rule'])
        props.update(locals())

        # Apply the config
        if target_type == 'vserver':
            config = CONFIG_VSERVER % (props)
            CTK.cfg.apply_chunk(config)
            AddUsualStaticFiles(props['pre_rule_plus4'])
            CTK.cfg.normalize('%s!rule' % (pre_vsrv))

        elif target_type == 'directory':
            config = CONFIG_DIR % (props)
            CTK.cfg.apply_chunk(config)

        box += CTK.RawHTML(
            js=CTK.DruidContent__JS_to_goto(box.id, URL_POST_INSTALL))
        return box.Render().toStr()
Ejemplo n.º 13
0
    def __call__ (self):
        # Find the DMG file
        dmg_refs = Downloads.get_latest_macosx_dmg()

        # No MacOS package found
        if not dmg_refs:
            content = CTK.Container()
            content += CTK.RawHTML ("<h3>%s</h3>" %(_("Could not find the MacOS X package")))
            content += CTK.RawHTML ("<p>%s</p>" %(_("It seems that the MacOS X package for the latest version has not been compiled yet.")))
            content += CTK.RawHTML ("<p>%s</p>" %(_("Due the circunstances, we encourage you to download the source code and compile it by hand.")))
            return CTK.HTTP_Cacheable (60, body = content.Render().toStr())

        dmg_local, dmg_web = dmg_refs
        dmg_url = "http://www.cherokee-project.com%s"%(dmg_web)

        if os.path.exists (dmg_local):
            mbs = os.path.getsize (dmg_local) / (1024**2)
        else:
            mbs = 0
        ver = re.findall (r'(\d+\.\d+\.\d+)', dmg_web)[0]

        download_button = CTK.Button ('Get Cherokee %s DMG'%(ver)) # ??? %sMb'%(mbs))
        download_button.bind ('click', CTK.DruidContent__JS_to_goto (download_button.id, URL_MACOSX_2))

        content = CTK.Container()
        content += CTK.RawHTML ('<h3>Binary Package</h3>')
        content += CTK.RawHTML ('<p>%s</p>'%(_("A binary package for MacOS X (Intel) is available for download: %sMb"%(mbs))))
        content += download_button

        return CTK.HTTP_Cacheable (60, body=content.Render().toStr())
Ejemplo n.º 14
0
    def __safe_call__(self):
        box = CTK.Box()
        box += CTK.RawHTML('<h2>%s</h2>' % (_("Nagios start up")))
        box += CTK.RawHTML('<p>%s</p>' % (_(
            "Nagios requires the Nagios system service to be launched at boot time. It is recommended that you allow the installer to add the service to your system."
        )))

        table = CTK.PropsTable()
        table.Add(
            _('Add system service'),
            CTK.CheckCfgText('%s!nagiosstartup' % (PRE), True, _('Enable'),
                             {'class': 'noauto'}),
            _('Mark the checkbox to automatically launch Nagios on start up.'))

        submit = CTK.Submitter(URL_APPLY)
        submit += table
        submit.bind('submit_success',
                    CTK.DruidContent__JS_to_goto(box.id, URL_LAUNCH_SERVICE))
        box += submit

        buttons = CTK.DruidButtonsPanel()
        buttons += CTK.DruidButton_Close(_('Cancel'))
        buttons += CTK.DruidButton_Submit(_('Next'), do_close=False)
        box += buttons

        return box.Render().toStr()
Ejemplo n.º 15
0
    def __safe_call__(self):
        box = CTK.Box()
        box += CTK.RawHTML('<h2>%s</h2>' % (_("Checking Requirements")))

        buttons = CTK.DruidButtonsPanel()
        buttons += CTK.DruidButton_Close(_('Cancel'))
        buttons += CTK.DruidButton_Goto(_('Retry'),
                                        URL_PRECONDITION,
                                        do_submit=True)

        # CC
        if not cc.detect_cc():
            box += InstructionBox(_(cc.NOTE), cc.CC_INSTRUCTIONS)
            box += buttons
            return box.Render().toStr()

        # Database
        supported_dbs = database.get_supported_dbs(DB_SUPPORTED)
        if not supported_dbs:
            box += database.PreconditionError(DB_SUPPORTED)
            box += buttons
            return box.Render().toStr()

        box += CTK.RawHTML(js=CTK.DruidContent__JS_to_goto(box.id, URL_TARGET))
        return box.Render().toStr()
Ejemplo n.º 16
0
    def __safe_call__(self):
        box = CTK.Box()
        box += CTK.RawHTML('<h2>%s</h2>' % (_("Checking Dependencies")))

        buttons = CTK.DruidButtonsPanel()
        buttons += CTK.DruidButton_Close(_('Cancel'))
        buttons += CTK.DruidButton_Goto(_('Retry'),
                                        URL_PRECONDITION,
                                        do_submit=True)

        # Check PHP
        php_cgi_bin = php.figure_phpcgi_binary()

        if not php_cgi_bin:
            box += php.PHP_Interpreter_Not_Found_Widget()
            box += buttons
            return box.Render().toStr()

        # Database
        supported_dbs = database.get_supported_dbs(DB_SUPPORTED)
        if not supported_dbs:
            box += database.PreconditionError(DB_SUPPORTED)
            box += buttons
            return box.Render().toStr()

        # PHP modules
        error = tools.check_requirements()
        if error:
            box += InstructionBox(error[0], error[1])
            box += buttons
            return box.Render().toStr()

        box += CTK.RawHTML(js=CTK.DruidContent__JS_to_goto(box.id, URL_TARGET))
        return box.Render().toStr()
Ejemplo n.º 17
0
    def __safe_call__(self):
        box = CTK.Box()
        box += CTK.RawHTML('<h2>%s</h2>' % (_("Checking Requirements")))

        buttons = CTK.DruidButtonsPanel()
        buttons += CTK.DruidButton_Close(_('Cancel'))
        buttons += CTK.DruidButton_Goto(_('Retry'),
                                        URL_PRECONDITION,
                                        do_submit=True)

        # Check PHP
        php_cgi_bin = php.figure_phpcgi_binary()

        if not php_cgi_bin:
            box += php.PHP_Interpreter_Not_Found_Widget()
            box += buttons
            return box.Render().toStr()

        # Database
        supported_dbs = database.get_supported_dbs(DB_SUPPORTED)
        if not supported_dbs:
            box += database.PreconditionError(DB_SUPPORTED)
            box += buttons
            return box.Render().toStr()

        # Check PHP modules
        error = tools.check_modules()
        if error:
            note, instructions = error
            box += market.Util.InstructionBox(note,
                                              instructions,
                                              bin_path=php_cgi_bin)
            box += buttons
            return box.Render().toStr()

        # Check PHP settings
        setting_errors = tools.check_settings()
        if setting_errors:
            box += CTK.RawHTML('<p>%s</p>' % (_(
                "Some of your PHP settings do not meet Vanilla's requirements. Please edit your PHP configuration files and try again."
            )))
            table = CTK.Table({'class': 'infosection'})
            table.set_header(1)
            table += [
                CTK.RawHTML(x)
                for x in ('%s ' % _('Setting'), '%s ' % _('Expected value'),
                          _('Current value'))
            ]
            for setting_test in setting_errors:
                table += [CTK.RawHTML(str(x)) for x in setting_test]

            box += CTK.Indenter(table)
            box += buttons
            return box.Render().toStr()

        box += CTK.RawHTML(js=CTK.DruidContent__JS_to_goto(box.id, URL_TARGET))
        return box.Render().toStr()
Ejemplo n.º 18
0
    def __safe_call__(self):
        box = CTK.Box()
        pre = 'tmp!market!install'

        # Replacements
        app_id = CTK.cfg.get_val('%s!app!application_id' % (pre))
        app_name = CTK.cfg.get_val('%s!app!application_name' % (pre))
        root = CTK.cfg.get_val('%s!root' % (pre))
        target_type = CTK.cfg.get_val('%s!target' % (pre))
        target_vserver = CTK.cfg.get_val('%s!target!vserver' % (pre))
        target_vserver_n = CTK.cfg.get_val('%s!target!vserver_n' % (pre))
        target_directory = CTK.cfg.get_val('%s!target!directory' % (pre),
                                           '/wiki')
        pre_vsrv = 'vserver!%s' % (target_vserver_n)
        script_path = ['/w', '/wiki'][target_directory in ['/w', '/w/']]

        # PHP info
        php_info = php.get_info(pre_vsrv)

        # More replacements
        props = cfg_get_surrounding_repls('pre_rule', php_info['rule'])
        props.update(locals())

        # Write auxiliary files
        try:
            f = open(
                os.path.join(root, 'mediawiki', 'config', 'LocalSettings.inc'),
                'w+')
            f.write(LOCAL_SETTINGS % (locals()))
            market.Install_Log.log("Success: LocalSettings.inc written.")
        except:
            market.Install_Log.log("Error: LocalSettings.inc not written.")
            raise

        try:
            f = open(os.path.join(root, 'mediawiki', 'robots.txt'), 'w+')
            f.write(ROBOTS_TXT % (locals()))
            market.Install_Log.log("Success: robots.txt written")
        except:
            market.Install_Log.log("Error: robots.txt not written")
            raise

        # Apply the config
        if target_type == 'vserver':
            config = CONFIG_VSERVER % (props)
            AddUsualStaticFiles(props['pre_rule_minus1'])
            CTK.cfg.apply_chunk(config)

        elif target_type == 'directory':
            config = CONFIG_DIR % (props)
            CTK.cfg.apply_chunk(config)
            CTK.cfg.normalize('%s!rule' % (pre_vsrv))

        # Redirect to post installation
        box += CTK.RawHTML(
            js=CTK.DruidContent__JS_to_goto(box.id, URL_POST_INSTALL))
        return box.Render().toStr()
Ejemplo n.º 19
0
        def __init__ (self, command_progress):
            CTK.Container.__init__ (self)

            # Length and current
            commands_len = len(command_progress.commands)
            if command_progress.error or \
               command_progress.executed >= commands_len:
                command_entry = command_progress.commands [command_progress.executed - 1]
            else:
                command_entry = command_progress.commands [command_progress.executed]

            # Title
            if command_entry.has_key('description'):
                title = CTK.escape_html (command_entry['description'])
            elif command_entry.has_key('command'):
                title = CTK.escape_html (command_entry['command'])
            elif command_entry.has_key('function'):
                title = CTK.escape_html (command_entry['function'].__name__)
            else:
                assert False, 'Unknown command entry type'

            # Error
            if command_progress.error:
                ret     = command_progress.last_popen_ret
                percent = command_progress.executed * 100.0 / (commands_len + 1)

                if ret.get('command'):
                    title_error = CTK.escape_html (ret['command'])
                elif command_entry.has_key ('function'):
                    title_error = CTK.escape_html (command_entry['function'].__name__)
                else:
                    title_error = _("Unknown Error")

                error_content  = CTK.Box ({'class': 'market-commands-exec-error-details'})
                error_content += CTK.RawHTML ("<pre>%s</pre>" %(error_to_HTML(ret['stderr'])))

                details  = CTK.CollapsibleEasy ((_(MORE), _(LESS)))
                details += error_content

                self += CTK.ProgressBar ({'value': percent})
                self += CTK.RawHTML ("<p><b>%s</b>: %s</p>" %(_("Error executing"), title_error))
                self += details
                return

            # Regular
            percent = (command_progress.executed + 1) * 100.0 / (commands_len + 1)
            self += CTK.ProgressBar ({'value': percent})
            self += CTK.Box ({'class': 'market-commands-exec-command'}, CTK.RawHTML ("<p>%s</p>" %(title)))

            # Next step
            if command_progress.executed < commands_len:
                JS = "update = function(){%s}; setTimeout ('update()', %s);"
                self += CTK.RawHTML (js = JS%(command_progress.refresh.JS_to_refresh(), DELAY))
            else:
                self += CTK.RawHTML (js = CTK.DruidContent__JS_to_goto (command_progress.id, command_progress.finished_url))
    def __safe_call__(self):
        box = CTK.Box()
        pre = 'tmp!market!install'

        # Replacements
        app_id = CTK.cfg.get_val('%s!app!application_id' % (pre))
        app_name = CTK.cfg.get_val('%s!app!application_name' % (pre))
        root = CTK.cfg.get_val('%s!root' % (pre))
        target_type = CTK.cfg.get_val('%s!target' % (pre))
        target_vserver = CTK.cfg.get_val('%s!target!vserver' % (pre))
        target_vserver_n = CTK.cfg.get_val('%s!target!vserver_n' % (pre))
        target_directory = CTK.cfg.get_val('%s!target!directory' % (pre))
        deployment_lang = CTK.cfg.get_val('%s!wordpress!lang' % (pre), 'en')
        pre_vsrv = 'vserver!%s' % (target_vserver_n)

        # PHP info
        php_info = php.get_info(pre_vsrv)

        # More replacements
        props = cfg_get_surrounding_repls('pre_rule', php_info['rule'])
        props.update(locals())

        # Link correct language
        popen.popen_sync(
            'ln -fs %(root)s/wp-%(deployment_lang)s/wordpress %(root)s/wordpress'
            % (locals()))
        popen.popen_sync(
            'cp -r %(root)s/plugins/* %(root)s/wordpress/wp-content/plugins' %
            (locals()))

        # Provide DB details
        tools.configure_database(root)

        # Optional steps (if Cache module is present)
        if os.path.isfile(os.path.join(root, 'wp-cache-config.php')):
            tools.extend_sample_config_file(root)
            tools.move_cache_advanced(root)
            tools.move_cache_config(root)

        # Apply the config
        if target_type == 'vserver':
            config = CONFIG_VSERVER % (props)
            CTK.cfg.apply_chunk(config)
            AddUsualStaticFiles(props['pre_rule_plus1'],
                                ['/favicon.ico', '/crossdomain.xml'])
            CTK.cfg.normalize('%s!rule' % (pre_vsrv))

        elif target_type == 'directory':
            config = CONFIG_DIR % (props)
            CTK.cfg.apply_chunk(config)

        box += CTK.RawHTML(
            js=CTK.DruidContent__JS_to_goto(box.id, URL_POST_INSTALL))
        return box.Render().toStr()
Ejemplo n.º 21
0
    def __call__(self):
        configs = _get_configs()
        panel = CTK.DruidButtonsPanel()
        content = CTK.Container()

        error = CTK.cfg.get_val('tmp!backup!retrieve!error', '')
        if error:
            content += CTK.RawHTML('<h2>%s</h2>' % (_(NOTE_RESTORE_ERROR_H2)))
            content += CTK.RawHTML('<p>%s</p>' % (_(NOTE_RESTORE_ERROR_P1)))
            content += CTK.RawHTML('<p><pre>%s</pre></p>' %
                                   (CTK.escape_html(error)))
            content += panel
            panel += CTK.DruidButton_Close(_('Close'))

        elif not configs:
            # Content
            content += CTK.Notice(content=CTK.RawHTML(_(NOTE_RESTORE_NO)))
            content += panel

            # Buttons
            panel += CTK.DruidButton_Close(_('Close'))

        else:
            form = Restore_Config_Form(configs)
            form.bind(
                'submit_success',
                CTK.DruidContent__JS_to_goto(form.id, URL_RESTORE_SUCCESS))
            form.bind('submit_fail',
                      CTK.DruidContent__JS_to_goto(form.id, URL_RESTORE_FAIL))

            # Content
            content += CTK.RawHTML('<p>%s</p>' % (_(NOTE_RESTORE_P1)))
            content += CTK.RawHTML('<p>%s</p>' % (_(NOTE_RESTORE_P2)))
            content += form
            content += panel

            # Buttons
            panel += CTK.DruidButton_Close(_('Cancel'))
            panel += CTK.DruidButton_Submit(_('Restore'))

        return content.Render().toStr()
Ejemplo n.º 22
0
    def __safe_call__(self):
        # Ensure the current UID has enough priviledges
        if not InstallUtil.current_UID_is_admin() and 0:
            box = CTK.Box()
            box += CTK.RawHTML('<h2>%s</h2>' % (_(NO_ROOT_H1)))
            box += CTK.RawHTML('<p>%s</p>' % (_(NO_ROOT_P1)))
            box += CTK.RawHTML('<p>%s</p>' % (_(NO_ROOT_P2)))

            buttons = CTK.DruidButtonsPanel()
            buttons += CTK.DruidButton_Close(_('Cancel'))
            box += buttons

            return box.Render().toStr()

        # Check the rest of pre-requisites
        index = Distro.Index()
        app_id = CTK.cfg.get_val('tmp!market!install!app!application_id')
        app = index.get_package(app_id, 'software')

        inst = index.get_package(app_id, 'installation')
        if 'cherokee_min_ver' in inst:
            version = inst['cherokee_min_ver']
            if version_cmp(VERSION, version) < 0:
                box = CTK.Box()
                box += CTK.RawHTML('<h2>%s</h2>' % (_(MIN_VER_H1)))
                box += CTK.RawHTML('<p>%s</p>' % (_(MIN_VER_P1) % (locals())))

                buttons = CTK.DruidButtonsPanel()
                buttons += CTK.DruidButton_Close(_('Cancel'))

                box += buttons
                return box.Render().toStr()

        # Init the log file
        Install_Log.reset()
        Install_Log.log(".---------------------------------------------.")
        Install_Log.log("| PLEASE, DO NOT EDIT OR REMOVE THIS LOG FILE |")
        Install_Log.log("|                                             |")
        Install_Log.log("| It contains useful information that         |")
        Install_Log.log("| cherokee-admin might need in the future.    |")
        Install_Log.log(".---------------------------------------------.")
        Install_Log.log("Retrieving package information...")

        # Check whether there are CTK.cfg changes to be saved
        changes = "01"[int(CTK.cfg.has_changed())]
        CTK.cfg['tmp!market!install!cfg_previous_changes'] = changes

        # Render a welcome message
        box = CTK.Box()
        box += CTK.RawHTML(
            js=CTK.DruidContent__JS_to_goto(box.id, URL_INSTALL_DOWNLOAD))

        return box.Render().toStr()
    def __safe_call__ (self):
        box = CTK.Box()
        db_widget = database.MethodSelection (DB_SUPPORTED)
        db_widget.bind ('goto_next_stage', CTK.DruidContent__JS_to_goto (box.id, URL_SERVER))
        box += db_widget

        buttons = CTK.DruidButtonsPanel()
        buttons += CTK.DruidButton_Close(_('Cancel'))
        buttons += CTK.DruidButton_Submit (_('Next'), do_close=False)
        box += buttons

        return box.Render().toStr()
    def __safe_call__ (self):
        box = CTK.Box()
        target_wid = target.TargetSelection()
        target_wid.bind ('goto_next_stage', CTK.DruidContent__JS_to_goto (box.id, php.URL_PHP_CONFIG_INTRO))
        box += target_wid

        buttons = CTK.DruidButtonsPanel()
        buttons += CTK.DruidButton_Close(_('Cancel'))
        buttons += CTK.DruidButton_Submit (_('Next'), do_close=False)
        box += buttons

        return box.Render().toStr()
Ejemplo n.º 25
0
    def __safe_call__(self):
        box = CTK.Box()
        box += CTK.RawHTML('<h2>%s</h2>' % (_("Nagios start up")))

        system_info = SystemInfo.get_info()
        OS = system_info.get('system', '').lower()

        root = CTK.cfg.get_val('%s!root' % (PRE))
        startup = CTK.cfg.get_val('%s!nagiosstartup' % (PRE))
        plist = os.path.join(root, 'nrpe.plist')

        # Register service: init.d, launchd, etc.
        ret = services.register_service('nagios', macos_plist=plist)
        if ret['retcode'] == 0:
            # Launch
            if startup:
                if OS == 'darwin':
                    services.launch_service('org.nagios.nrpe')
                else:
                    services.launch_service('nagios')

            box += CTK.RawHTML(
                js=CTK.DruidContent__JS_to_goto(box.id, URL_SERVER_CONFIG))
            return box.Render().toStr()

        # Error handling
        notice = CTK.Notice()
        notice += CTK.RawHTML('<p>%s</p>' % (_(
            'The installer could not successfully execute the following command:'
        )))
        notice += CTK.RawHTML('<pre>%s</pre>' % (ret['command']))
        notice += CTK.RawHTML('<p>%s</p>' % (_('The reported error was:')))
        notice += CTK.RawHTML('<pre>%s</pre>' % (ret['stderr']))

        box += CTK.RawHTML('<p>%s</p>' % (ret['error']))
        box += notice
        box += CTK.RawHTML('<p>%s</p>' % (_(
            'You can either manually fix the problem and retry, or you can skip the step knowing that the Nagios system service will not be launched at boot time.'
        )))

        buttons = CTK.DruidButtonsPanel()
        buttons += CTK.DruidButton_Close(_('Cancel'))
        buttons += CTK.DruidButton_Goto(_('Retry'),
                                        URL_LAUNCH_SERVICE,
                                        do_submit=True)
        buttons += CTK.DruidButton_Goto(_('Skip'),
                                        URL_SERVER_CONFIG,
                                        do_submit=True)
        box += buttons

        return box.Render().toStr()
Ejemplo n.º 26
0
    def __safe_call__(self):
        box = CTK.Box()

        # Automatic submit -> 'Save' button is updated.
        submit = CTK.Submitter(URL_INSTALL_DONE_APPLY)
        submit += CTK.Hidden('foo', 'bar')
        submit.bind(
            'submit_success',
            CTK.DruidContent__JS_to_goto(box.id, URL_INSTALL_DONE_CONTENT))

        box += submit
        box += CTK.RawHTML(js=submit.JS_to_submit())

        return box.Render().toStr()
    def __safe_call__(self):
        box = CTK.Box()
        details = Wiki_Details()
        details.bind('submit_success',
                     CTK.DruidContent__JS_to_goto(box.id, URL_INSTALLER_3))

        box += CTK.RawHTML('<h2>%s</h2>' % (_("Wiki details")))
        box += details

        buttons = CTK.DruidButtonsPanel()
        buttons += CTK.DruidButton_Close(_('Cancel'))
        buttons += CTK.DruidButton_Submit(_('Next'), do_close=False)
        box += buttons

        return box.Render().toStr()
Ejemplo n.º 28
0
    def __safe_call__(self):
        box = CTK.Box()
        box += CTK.RawHTML('<h2>%s</h2>' % (_("Checking Dependencies")))

        if tools.check_cc():
            box += CTK.RawHTML(
                js=CTK.DruidContent__JS_to_goto(box.id, URL_TARGET))
            return box.Render().toStr()

        box += InstructionBox(_(tools.DEP_NOTE), tools.DEP_INSTRUCTIONS)
        buttons = CTK.DruidButtonsPanel()
        buttons += CTK.DruidButton_Close(_('Cancel'))
        buttons += CTK.DruidButton_Goto(_('Retry'),
                                        URL_PRECONDITION,
                                        do_submit=True)
        return box.Render().toStr()
Ejemplo n.º 29
0
    def __safe_call__(self):
        box = CTK.Box()

        # Replacements
        app_id = CTK.cfg.get_val('%s!app!application_id' % (PRE))
        app_name = CTK.cfg.get_val('%s!app!application_name' % (PRE))
        root = CTK.cfg.get_val('%s!root' % (PRE))
        target_type = CTK.cfg.get_val('%s!target' % (PRE))
        target_vserver = CTK.cfg.get_val('%s!target!vserver' % (PRE))
        target_vserver_n = CTK.cfg.get_val('%s!target!vserver_n' % (PRE))
        target_directory = CTK.cfg.get_val('%s!target!directory' % (PRE))
        pre_vsrv = 'vserver!%s' % (target_vserver_n)

        password = CTK.cfg.get_val('%s!password' % (PRE))
        email = CTK.cfg.get_val('%s!email' % (PRE))
        nagiosadmin = CTK.cfg.get_val('%s!nagiosadmin' % (PRE))

        # PHP info
        php_info = php.get_info(pre_vsrv)

        # More replacements
        props = cfg_get_surrounding_repls('pre_rule', php_info['rule'])
        props.update(locals())

        # Apply the config
        if target_type == 'vserver':
            config = CONFIG_VSERVER % (props)
            CTK.cfg.apply_chunk(config)
            AddUsualStaticFiles(props['pre_rule_plus4'])
            CTK.cfg.normalize('%s!rule' % (pre_vsrv))

        elif target_type == 'directory':
            # Add index.html to index files if not present
            key = '%s!directory_index' % (pre_vsrv)
            index = CTK.cfg.get_val(key)
            if not 'index.html' in index:
                CTK.cfg[key] = ','.join(
                    [x.strip() for x in index.split(',') + ['index.html']])

            config = CONFIG_DIR % (props)
            CTK.cfg.apply_chunk(config)

        box += CTK.RawHTML(js=CTK.DruidContent__JS_to_goto(
            box.id, market.Install.URL_INSTALL_DONE))
        return box.Render().toStr()
    def __safe_call__(self):
        box = CTK.Box()
        box += CTK.RawHTML('<h1>%s</h1>' %
                           (_("Checking for installation requirements")))

        if java.detect_java('1.6'):
            box += CTK.RawHTML(
                js=CTK.DruidContent__JS_to_goto(box.id, URL_TARGET))
            return box.Render().toStr()

        box += InstructionBox(_(java.JAVA6_NOTE), java.JAVA6_INSTRUCTIONS)
        buttons = CTK.DruidButtonsPanel()
        buttons += CTK.DruidButton_Close(_('Cancel'))
        buttons += CTK.DruidButton_Goto(
            _('Retry'),
            market.Install.URL_INSTALL_SETUP_EXTERNAL,
            do_submit=True)
        return box.Render().toStr()