Exemplo n.º 1
0
 def purge(self, age_in_days):
     """Purge deleted rows older than a given age from <project_name> tables."""
     age_in_days = int(age_in_days)
     if age_in_days <= 0:
         print(_("Must supply a positive, non-zero value for age"))
         exit(1)
     ctxt = context.get_admin_context()
     db.purge_deleted_rows(ctxt, age_in_days)
Exemplo n.º 2
0
def setup_profiler(binary, host):
    if CONF.profiler.profiler_enabled:
        _notifier = osprofiler.notifier.create(
            "Messaging", messaging, context.get_admin_context().to_dict(),
            rpc.TRANSPORT, "<project_name>", binary, host)
        osprofiler.notifier.set(_notifier)
        LOG.warning(
            _LW("OSProfiler is enabled.\nIt means that person who knows "
                "any of hmac_keys that are specified in "
                "/etc/<project_name>/api-paste.ini can trace his requests. \n"
                "In real life only operator can read this file so there "
                "is no security issue. Note that even if person can "
                "trigger profiler, only admin user can retrieve trace "
                "information.\n"
                "To disable OSprofiler set in <project_name>.conf:\n"
                "[profiler]\nenabled=false"))
    else:
        osprofiler.web.disable()
Exemplo n.º 3
0
def get_test_admin_context():
    return context.get_admin_context()
Exemplo n.º 4
0
 def setUp(self):
     super(BaseTest, self).setUp()
     self.ctxt = context.get_admin_context()
Exemplo n.º 5
0
 def periodic_tasks(self, raise_on_error=False):
     """Tasks to be run at a periodic interval."""
     ctxt = context.get_admin_context()
     self.manager.periodic_tasks(ctxt, raise_on_error=raise_on_error)