Beispiel #1
0
    def ajaxUpdate(self):
        # Make sure this is requested via ajax
        request_type = cherrypy.request.headers.get('X-Requested-With')
        if str(request_type).lower() == 'xmlhttprequest':
            pass
        else:
            status_msg = "This page exists, but is not accessible via web browser"
            return serve_template(templatename="index.html", title="404 - Page Not Found", msg=status_msg)

        return serve_template(templatename="ajaxUpdate.html")
Beispiel #2
0
    def ajaxUpdate(self):
        # Make sure this is requested via ajax
        request_type = cherrypy.request.headers.get('X-Requested-With')
        if str(request_type).lower() == 'xmlhttprequest':
            pass
        else:
            status_msg = "This page exists, but is not accessible via web browser"
            return serve_template(templatename="index.html",
                                  title="404 - Page Not Found",
                                  msg=status_msg)

        return serve_template(templatename="ajaxUpdate.html")
Beispiel #3
0
 def update(self):
     cherrystrap.SIGNAL = 'update'
     message = 'updating ...'
     return serve_template(templatename="shutdown.html",
                           title="Update",
                           message=message,
                           timer=30)
Beispiel #4
0
 def restart(self):
     cherrystrap.SIGNAL = 'restart'
     message = 'restarting ...'
     return serve_template(templatename="shutdown.html",
                           title="Restart",
                           message=message,
                           timer=15)
Beispiel #5
0
    def operations(self, script=None, issue_list_input=None):
        status, msg = '', ''
        if jiraappy.JIRA_LOGIN_STATUS:
            consumer, client = backend.stored_oauth()

            if request.method == 'POST':
                script = request.params['script']
                issue_list_input = request.params['issue_list_input']
                issue_list = [x.strip() for x in issue_list_input.split(',')]

                if script == 'bulk-delete-worklogs' and issue_list_input:
                    status, msg = jiraInt.bulkDeleteWorklogs(issue_list)
                else:
                    status, msg = backend.ajaxMSG(
                        'failure', 'No issues entered for processing')
            else:
                pass
        else:
            status, msg = backend.ajaxMSG(
                'failure', 'Can not operate on JIRA without being logged in')

        return serve_template(templatename="operations.html",
                              title="Bulk Operations",
                              status=status,
                              msg=msg)
Beispiel #6
0
 def caller(self, call=None, action=None):
     status, msg = '', ''
     if call == 'reindex':
         status, msg = jiraInt.reindex(action)
     return serve_template(templatename="caller.html",
                           title="Call JIRA",
                           status=status,
                           msg=msg)
Beispiel #7
0
 def oauth_request(self):
     authorize_token_url, status, msg = backend.redirect_oauth()
     if not authorize_token_url:
         return serve_template(templatename="index.html",
                               title="Home",
                               status=status,
                               msg=msg)
     else:
         raise cherrypy.HTTPRedirect(authorize_token_url)
Beispiel #8
0
 def shutdown(self):
     cherrystrap.config_write()
     cherrystrap.SIGNAL = 'shutdown'
     message = 'shutting down ...'
     return serve_template(templatename="shutdown.html",
                           title="Exit",
                           message=message,
                           timer=15)
     return page
Beispiel #9
0
    def index(self):
        subroutine = subroutines()
        staticData = subroutine.static_subroutine()
        numCPUs = len(subroutine.cpuload_subroutine())
        numDisks = len(subroutine.diskio_subroutine())
        numPartitions = len(subroutine.partitions_subroutine())
        fansTemps = subroutine.sysfiles_subroutine()

        return serve_template(templatename="index.html", title="Home", staticData=staticData, numCPUs=numCPUs, numDisks=numDisks, numPartitions=numPartitions, fansTemps=fansTemps)
Beispiel #10
0
    def config(self):
        http_look_dir = os.path.join(cherrystrap.PROG_DIR, 'static/interfaces/')
        http_look_list = [ name for name in os.listdir(http_look_dir) if os.path.isdir(os.path.join(http_look_dir, name)) ]

        config = {
            "http_look_list":   http_look_list
        }

        return serve_template(templatename="config.html", title="Settings", config=config)
Beispiel #11
0
 def downloadLog(self, logFile=None):
     message = {}
     if logFile:
         try:
             return serve_file(logFile, "application/x-download", "attachment")
         except Exception, e:
             message['status'] = 'danger'
             message['message'] = 'There was a problem downloading log file %s' % logFile
             logger.error('There was a problem downloading log file %s: %s' % (logFile, e))
             return serve_template(templatename="logs.html", title="Logs", message=message)
Beispiel #12
0
    def index(self, oauth_token=None):
        if oauth_token:
            status, msg = backend.validate_oauth(oauth_token)
        else:
            status, msg = '', ''

        return serve_template(templatename="index.html",
                              title="Home",
                              status=status,
                              msg=msg)
Beispiel #13
0
 def oauth_logout(self):
     jiraappy.JIRA_OAUTH_TOKEN = None
     jiraappy.JIRA_OAUTH_SECRET = None
     cherrystrap.config_write()
     jiraappy.JIRA_LOGIN_STATUS = None
     jiraappy.JIRA_LOGIN_USER = None
     status, msg = backend.ajaxMSG('success',
                                   'Successfully logged out of JIRA OAuth')
     return serve_template(templatename="index.html",
                           title="Home",
                           status=status,
                           msg=msg)
Beispiel #14
0
    def checkGithub(self):
        # Make sure this is requested via ajax
        request_type = cherrypy.request.headers.get('X-Requested-With')
        if str(request_type).lower() == 'xmlhttprequest':
            pass
        else:
            status_msg = "This page exists, but is not accessible via web browser"
            return serve_template(templatename="index.html", title="404 - Page Not Found", msg=status_msg)

        from cherrystrap import versioncheck
        versioncheck.checkGithub()
        cherrystrap.IGNORE_UPDATES = False
Beispiel #15
0
    def config(self):
        http_look_dir = os.path.join(cherrystrap.PROG_DIR,
                                     'static/interfaces/')
        http_look_list = [
            name for name in os.listdir(http_look_dir)
            if os.path.isdir(os.path.join(http_look_dir, name))
        ]

        config = {"http_look_list": http_look_list}

        return serve_template(templatename="config.html",
                              title="Settings",
                              config=config)
Beispiel #16
0
    def checkGithub(self):
        # Make sure this is requested via ajax
        request_type = cherrypy.request.headers.get('X-Requested-With')
        if str(request_type).lower() == 'xmlhttprequest':
            pass
        else:
            status_msg = "This page exists, but is not accessible via web browser"
            return serve_template(templatename="index.html",
                                  title="404 - Page Not Found",
                                  msg=status_msg)

        from cherrystrap import versioncheck
        versioncheck.checkGithub()
        cherrystrap.IGNORE_UPDATES = False
Beispiel #17
0
 def processes(self):
     return serve_template(templatename="processes.html", title="Processes")
Beispiel #18
0
 def configlogs(self):
     return serve_template(templatename="configlogs.html", title="Configure Logs")
Beispiel #19
0
 def log(self):
     return serve_template(templatename="log.html", title="Log", lineList=cherrystrap.LOGLIST)
Beispiel #20
0
 def logs(self):
     return serve_template(templatename="logs.html", title="Logs")
Beispiel #21
0
 def logs(self):
     return serve_template(templatename="logs.html",
                           title="Log",
                           lineList=cherrystrap.LOGLIST)
Beispiel #22
0
 def template(self):
     return serve_template(templatename="template.html",
                           title="Template Reference")
Beispiel #23
0
 def error_page_404(status, message, traceback, version):
     status_msg = "%s - %s" % (status, message)
     return serve_template(templatename="index.html",
                           title="404 - Page Not Found",
                           msg=status_msg)
Beispiel #24
0
    def downloadLog(self, logFile=None):
        message = {}
        if logFile:
            try:
                return serve_file(logFile, "application/x-download", "attachment")
            except Exception, e:
                message['status'] = 'danger'
                message['message'] = 'There was a problem downloading log file %s' % logFile
                logger.error('There was a problem downloading log file %s: %s' % (logFile, e))
                return serve_template(templatename="logs.html", title="Logs", message=message)

        else:
            message['status'] = 'warning'
            message['message'] = 'You must define a logFile to download'
            return serve_template(templatename="logs.html", title="Logs", message=message)

    downloadLog.exposed = True

    @require()
    def shutdown(self):
        cherrystrap.config_write()
        cherrystrap.SIGNAL = 'shutdown'
        message = 'shutting down ...'
        return serve_template(templatename="shutdown.html", title="Exit", message=message, timer=10)
        return page
    shutdown.exposed = True

    @require()
    def restart(self):
        cherrystrap.SIGNAL = 'restart'
Beispiel #25
0
 def template(self):
     return serve_template(templatename="template.html", title="Template Reference")
Beispiel #26
0
 def listener(self):
     return serve_template(templatename="listener.html", title="Webhooks")
Beispiel #27
0
 def update(self):
     cherrystrap.SIGNAL = 'update'
     message = 'updating ...'
     return serve_template(templatename="shutdown.html", title="Update", message=message, timer=30)
Beispiel #28
0
 def shutdown(self):
     cherrystrap.config_write()
     cherrystrap.SIGNAL = 'shutdown'
     message = 'shutting down ...'
     return serve_template(templatename="shutdown.html", title="Exit", message=message, timer=15)
     return page
Beispiel #29
0
 def restart(self):
     cherrystrap.SIGNAL = 'restart'
     message = 'restarting ...'
     return serve_template(templatename="shutdown.html", title="Restart", message=message, timer=15)
Beispiel #30
0
 def configrules(self):
     return serve_template(templatename="configrules.html", title="Configure Rules")
Beispiel #31
0
 def error_page_404(status, message, traceback, version):
     status_msg = "%s - %s" % (status, message)
     return serve_template(templatename="index.html", title="404 - Page Not Found", msg=status_msg)
Beispiel #32
0
 def index(self):
     return serve_template(templatename="index.html", title="Home")
Beispiel #33
0
 def get_loginform(self, username, msg="Login Required", source="/"):
     return serve_template(templatename="login.html",
                           title="Login",
                           username=username,
                           msg=msg,
                           source=source)