Retire the project
Change-Id: Idc44edfa1c43504e21864c052058a26207a3b14c
This commit is contained in:
parent
18aa75f9d4
commit
0f1c7e9fd5
@ -1,4 +0,0 @@
|
||||
[gerrit]
|
||||
host=review.openstack.org
|
||||
port=29418
|
||||
project=stackforge/cerberus-dashboard.git
|
@ -1,16 +0,0 @@
|
||||
If you would like to contribute to the development of OpenStack,
|
||||
you must follow the steps in this page:
|
||||
|
||||
http://docs.openstack.org/infra/manual/developers.html
|
||||
|
||||
Once those steps have been completed, changes to OpenStack
|
||||
should be submitted for review via the Gerrit tool, following
|
||||
the workflow documented at:
|
||||
|
||||
http://docs.openstack.org/infra/manual/developers.html#development-workflow
|
||||
|
||||
Pull requests submitted through GitHub will be ignored.
|
||||
|
||||
Bugs should be filed on Launchpad, not GitHub:
|
||||
|
||||
https://bugs.launchpad.net/cerberus-dashboard
|
@ -1,4 +0,0 @@
|
||||
cerberus-dashboard Style Commandments
|
||||
===============================================
|
||||
|
||||
Read the OpenStack Style Commandments http://docs.openstack.org/developer/hacking/
|
176
LICENSE
176
LICENSE
@ -1,176 +0,0 @@
|
||||
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
@ -1,6 +0,0 @@
|
||||
include AUTHORS
|
||||
include ChangeLog
|
||||
exclude .gitignore
|
||||
exclude .gitreview
|
||||
|
||||
global-exclude *.pyc
|
21
README.rst
21
README.rst
@ -1,15 +1,10 @@
|
||||
===============================
|
||||
cerberus-dashboard
|
||||
===============================
|
||||
This project is no longer maintained.
|
||||
|
||||
Dashboard for Openstack Cerberus
|
||||
The contents of this repository are still available in the Git
|
||||
source code management system. To see the contents of this
|
||||
repository before it reached its end of life, please check out the
|
||||
previous commit with "git checkout HEAD^1".
|
||||
|
||||
* Free software: Apache license
|
||||
* Documentation: http://docs.openstack.org/developer/cerberus-dashboard
|
||||
* Source: http://git.openstack.org/cgit/openstack/cerberus-dashboard
|
||||
* Bugs: http://bugs.launchpad.net/replace with the name of the project on launchpad
|
||||
|
||||
Features
|
||||
--------
|
||||
|
||||
* TODO
|
||||
For any further questions, please email
|
||||
openstack-dev@lists.openstack.org or join #openstack-dev on
|
||||
Freenode.
|
||||
|
@ -1,9 +0,0 @@
|
||||
from cerberusdashboard import exceptions
|
||||
|
||||
DASHBOARD = 'security'
|
||||
ADD_INSTALLED_APPS = ['cerberusdashboard']
|
||||
DEFAULT = True
|
||||
ADD_EXCEPTIONS = {
|
||||
'recoverable': exceptions.RECOVERABLE,
|
||||
'not_found': exceptions.NOT_FOUND,
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import pbr.version
|
||||
|
||||
|
||||
__version__ = pbr.version.VersionInfo(
|
||||
'cerberus-dashboard').version_string()
|
@ -1,151 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2015 EUROGICIEL
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
import logging
|
||||
|
||||
from cerberusclient import client as cerberus_client
|
||||
from horizon.utils.memoized import memoized # noqa
|
||||
from openstack_dashboard.api import base
|
||||
try:
|
||||
from sticksclient import client as sticks_client
|
||||
from sticksclient.common import exceptions as sticks_exc
|
||||
except ImportError:
|
||||
sticks_exc = None
|
||||
sticks_client = None
|
||||
pass
|
||||
|
||||
from cerberusdashboard.utils import importutils
|
||||
|
||||
keystone = importutils.import_any('openstack_dashboard.api.keystone',
|
||||
'horizon.api.keystone')
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@memoized
|
||||
def cerberusclient(request):
|
||||
"""Initialization of Cerberus client."""
|
||||
cerberus_endpoint = base.url_for(request, 'security')
|
||||
return cerberus_client.Client('1',
|
||||
cerberus_endpoint,
|
||||
tenant_id=request.user.tenant_id,
|
||||
token=request.user.token.id)
|
||||
|
||||
|
||||
@memoized
|
||||
def sticksclient(request):
|
||||
"""Initialization of Cerberus client."""
|
||||
sticks_endpoint = base.url_for(request, 'helpdesk')
|
||||
return sticks_client.Client('1',
|
||||
sticks_endpoint,
|
||||
tenant_id=request.user.tenant_id,
|
||||
token=request.user.token.id)
|
||||
|
||||
|
||||
def plugin_list(request):
|
||||
"""List plugins."""
|
||||
return cerberusclient(request).plugins.list()
|
||||
|
||||
|
||||
def plugin_get(request, plugin_id):
|
||||
"""Get plugin information."""
|
||||
return cerberusclient(request).plugins.get(plugin_id)
|
||||
|
||||
|
||||
def task_list(request):
|
||||
"""List tasks."""
|
||||
return cerberusclient(request).tasks.list()
|
||||
|
||||
|
||||
def task_get(request, task_id):
|
||||
"""Get specific task."""
|
||||
return cerberusclient(request).tasks.get(task_id)
|
||||
|
||||
|
||||
def task_create(request, plugin_id, method, name='unknown', type='unique',
|
||||
period=None):
|
||||
"""Create a task."""
|
||||
return cerberusclient(request).tasks.create(
|
||||
plugin_id, method, name, type, period)
|
||||
|
||||
|
||||
def task_stop(request, task_id):
|
||||
"""Stop specific task."""
|
||||
return cerberusclient(request).tasks.stop(task_id)
|
||||
|
||||
|
||||
def task_restart(request, task_id):
|
||||
"""Stop specific task."""
|
||||
return cerberusclient(request).tasks.restart(task_id)
|
||||
|
||||
|
||||
def task_delete(request, task_id):
|
||||
"""Delete specific task."""
|
||||
return cerberusclient(request).tasks.delete(task_id)
|
||||
|
||||
|
||||
def task_force_delete(request, task_id):
|
||||
"""Force delete specific task."""
|
||||
return cerberusclient(request).tasks.force_delete(task_id)
|
||||
|
||||
|
||||
def security_report_list(request):
|
||||
"""List the security reports."""
|
||||
return cerberusclient(request).security_reports.list()
|
||||
|
||||
|
||||
def security_report_get(request, sr_uuid):
|
||||
"""Get a security report."""
|
||||
return cerberusclient(request).security_reports.get(sr_uuid)
|
||||
|
||||
|
||||
def security_report_put_ticket_id(request, sr_uuid, ticket_id):
|
||||
"""Update a security report by adding its associated ticket id."""
|
||||
return cerberusclient(request).security_reports.put(sr_uuid, ticket_id)
|
||||
|
||||
|
||||
def security_alarm_list(request):
|
||||
"""List the security alarms."""
|
||||
return cerberusclient(request).security_alarms.list()
|
||||
|
||||
|
||||
def security_alarm_get(request, security_alarm_id):
|
||||
"""Get a security alarm."""
|
||||
|
||||
return cerberusclient(request).security_alarms.get(security_alarm_id)
|
||||
|
||||
|
||||
def security_alarm_put_ticket_id(request, sa_id, ticket_id):
|
||||
"""Update a security report by adding its associated ticket id."""
|
||||
return cerberusclient(request).security_alarms.put(sa_id, ticket_id)
|
||||
|
||||
|
||||
def ticket_create(request, data):
|
||||
"""Create a ticket from a security report."""
|
||||
return sticksclient(request).tickets.create(data)
|
||||
|
||||
|
||||
def is_sticks_available(request):
|
||||
"""Create a ticket from a security report."""
|
||||
if sticks_client is None:
|
||||
LOG.exception("No module named sticksclient")
|
||||
return False
|
||||
try:
|
||||
return isinstance(sticksclient(request).tickets.list(
|
||||
data={'project': request.user.tenant_id}), list)
|
||||
except sticks_exc.CommunicationError as e:
|
||||
LOG.exception(e)
|
||||
return False
|
@ -1,30 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2015 EUROGICIEL
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
from django.utils.translation import ugettext as _
|
||||
|
||||
import horizon
|
||||
|
||||
|
||||
class Cerberus(horizon.Dashboard):
|
||||
name = _("Security")
|
||||
slug = "security"
|
||||
panels = ("security_reports", "tasks", "plugins", "security_alarms")
|
||||
default_panel = 'security_reports'
|
||||
nav = True
|
||||
supports_tenants = True
|
||||
|
||||
horizon.register(Cerberus)
|
@ -1,27 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2015 EUROGICIEL
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
from cerberusclient.common import exceptions as cerberusclient
|
||||
try:
|
||||
from sticksclient.common import exceptions as sticksclient
|
||||
# HTTPInternalServerError is thrown by Redmine when project does not exist
|
||||
# This error may change in the future (refer to sticks client)
|
||||
RECOVERABLE = (sticksclient.HTTPInternalServerError,)
|
||||
except ImportError:
|
||||
RECOVERABLE = ()
|
||||
pass
|
||||
|
||||
NOT_FOUND = (cerberusclient.HTTPNotFound,)
|
@ -1,73 +0,0 @@
|
||||
# Copyright 2011 OpenStack Foundation.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
"""
|
||||
Import related utilities and helper functions.
|
||||
"""
|
||||
|
||||
import sys
|
||||
import traceback
|
||||
|
||||
|
||||
def import_class(import_str):
|
||||
"""Returns a class from a string including module and class."""
|
||||
mod_str, _sep, class_str = import_str.rpartition('.')
|
||||
try:
|
||||
__import__(mod_str)
|
||||
return getattr(sys.modules[mod_str], class_str)
|
||||
except (ValueError, AttributeError):
|
||||
raise ImportError('Class %s cannot be found (%s)' %
|
||||
(class_str,
|
||||
traceback.format_exception(*sys.exc_info())))
|
||||
|
||||
|
||||
def import_object(import_str, *args, **kwargs):
|
||||
"""Import a class and return an instance of it."""
|
||||
return import_class(import_str)(*args, **kwargs)
|
||||
|
||||
|
||||
def import_object_ns(name_space, import_str, *args, **kwargs):
|
||||
"""Tries to import object from default namespace.
|
||||
|
||||
Imports a class and return an instance of it, first by trying
|
||||
to find the class in a default namespace, then failing back to
|
||||
a full path if not found in the default namespace.
|
||||
"""
|
||||
import_value = "%s.%s" % (name_space, import_str)
|
||||
try:
|
||||
return import_class(import_value)(*args, **kwargs)
|
||||
except ImportError:
|
||||
return import_class(import_str)(*args, **kwargs)
|
||||
|
||||
|
||||
def import_module(import_str):
|
||||
"""Import a module."""
|
||||
__import__(import_str)
|
||||
return sys.modules[import_str]
|
||||
|
||||
|
||||
def import_versioned_module(version, submodule=None):
|
||||
module = 'solumdashboard.v%s' % version
|
||||
if submodule:
|
||||
module = '.'.join((module, submodule))
|
||||
return import_module(module)
|
||||
|
||||
|
||||
def try_import(import_str, default=None):
|
||||
"""Try to import a module and if it fails return default."""
|
||||
try:
|
||||
return import_module(import_str)
|
||||
except ImportError:
|
||||
return default
|
@ -1,28 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2015 EUROGICIEL
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
import horizon
|
||||
|
||||
from cerberusdashboard import dashboard
|
||||
|
||||
|
||||
class PluginsPanel(horizon.Panel):
|
||||
name = _("Plugins")
|
||||
slug = 'plugins'
|
||||
permissions = ('openstack.roles.admin',)
|
||||
|
||||
dashboard.Cerberus.register(PluginsPanel)
|
@ -1,38 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2015 EUROGICIEL
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from horizon import tables
|
||||
|
||||
|
||||
class PluginsTable(tables.DataTable):
|
||||
uuid = tables.Column("uuid",
|
||||
link=("horizon:security:plugins:details"),
|
||||
verbose_name="uuid",)
|
||||
name = tables.Column("name", verbose_name=_("Name"))
|
||||
version = tables.Column("version", verbose_name=_("Version"))
|
||||
provider = tables.Column("provider", verbose_name=_("Provider"))
|
||||
type = tables.Column("type", verbose_name=_("Type"))
|
||||
description = tables.Column("description", verbose_name=_("Description"),
|
||||
truncate=30)
|
||||
tool_name = tables.Column("tool_name", verbose_name=_("Tool name"))
|
||||
|
||||
def get_object_id(self, datum):
|
||||
return datum.uuid
|
||||
|
||||
class Meta:
|
||||
name = "plugins"
|
||||
verbose_name = _("Plugins")
|
@ -1,33 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2015 EUROGICIEL
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from horizon import tabs
|
||||
|
||||
|
||||
class OverviewTab(tabs.Tab):
|
||||
name = _("Overview")
|
||||
slug = "overview"
|
||||
template_name = "plugins/_detail_overview.html"
|
||||
|
||||
def get_context_data(self, request):
|
||||
return {"plugin": self.tab_group.kwargs['plugin']}
|
||||
|
||||
|
||||
class PluginDetailTabs(tabs.TabGroup):
|
||||
slug = "plugin_details"
|
||||
tabs = (OverviewTab,)
|
@ -1,30 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2015 EUROGICIEL
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
from django.conf.urls import patterns
|
||||
from django.conf.urls import url
|
||||
|
||||
import cerberusdashboard.plugins.views as views
|
||||
|
||||
|
||||
urlpatterns = patterns('',
|
||||
url(r'^$', views.IndexView.as_view(),
|
||||
name='index'),
|
||||
url(r'^$', views.IndexView.as_view(),
|
||||
name='plugins'),
|
||||
url(r'^(?P<plugin_id>[^/]+)$',
|
||||
views.DetailView.as_view(),
|
||||
name='details'),)
|
@ -1,78 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2015 EUROGICIEL
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
from django.core.urlresolvers import reverse_lazy
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
import logging
|
||||
|
||||
from horizon import exceptions
|
||||
from horizon import tables
|
||||
from horizon import tabs
|
||||
|
||||
from cerberusdashboard import api
|
||||
from cerberusdashboard.plugins import tables as p_tables
|
||||
from cerberusdashboard.plugins import tabs as p_tabs
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class IndexView(tables.DataTableView):
|
||||
table_class = p_tables.PluginsTable
|
||||
template_name = 'plugins/index.html'
|
||||
|
||||
@staticmethod
|
||||
def get_redirect_url():
|
||||
return reverse_lazy('horizon:security:plugins:index')
|
||||
|
||||
def get_data(self):
|
||||
try:
|
||||
plugins = api.cerberus.plugin_list(self.request)
|
||||
except Exception as e:
|
||||
LOG.exception(e)
|
||||
exceptions.handle(self.request,
|
||||
_('Unable to retrieve plugins details.'),
|
||||
redirect=self.get_redirect_url())
|
||||
return plugins
|
||||
|
||||
|
||||
class DetailView(tabs.TabView):
|
||||
tab_group_class = p_tabs.PluginDetailTabs
|
||||
template_name = 'plugins/detail.html'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(DetailView, self).get_context_data(**kwargs)
|
||||
plugin = self.get_data()
|
||||
context["plugin"] = plugin
|
||||
return context
|
||||
|
||||
def get_data(self):
|
||||
try:
|
||||
return api.cerberus.plugin_get(self.request,
|
||||
self.kwargs['plugin_id'])
|
||||
except Exception as e:
|
||||
LOG.exception(e)
|
||||
exceptions.handle(self.request,
|
||||
_('Unable to retrieve plugin details.'),
|
||||
redirect=self.get_redirect_url())
|
||||
|
||||
@staticmethod
|
||||
def get_redirect_url():
|
||||
return reverse_lazy('horizon:security:plugins:index')
|
||||
|
||||
def get_tabs(self, request, *args, **kwargs):
|
||||
plugin = self.get_data()
|
||||
return self.tab_group_class(request, plugin=plugin, **kwargs)
|
@ -1,28 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2015 EUROGICIEL
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
import horizon
|
||||
|
||||
from cerberusdashboard import dashboard
|
||||
|
||||
|
||||
class SecurityAlarmsPanel(horizon.Panel):
|
||||
name = _("Security Alarms")
|
||||
slug = 'security_alarms'
|
||||
permissions = ('openstack.roles.admin',)
|
||||
|
||||
dashboard.Cerberus.register(SecurityAlarmsPanel)
|
@ -1,114 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2015 EUROGICIEL
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
import logging
|
||||
|
||||
from django.core import urlresolvers
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from horizon import exceptions
|
||||
from horizon import tables
|
||||
|
||||
from cerberusdashboard import api
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def is_associated(alarm):
|
||||
ticket_id = getattr(alarm, "ticket_id", None)
|
||||
if not ticket_id:
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
|
||||
class CreateTicket(tables.BatchAction):
|
||||
name = "create_ticket"
|
||||
action_present = _("Create")
|
||||
action_past = _("%(data_type)s created")
|
||||
data_type_singular = _("Ticket")
|
||||
data_type_plural = _("Tickets")
|
||||
classes = ('btn-danger', 'btn-terminate')
|
||||
failure_url = urlresolvers.reverse_lazy(
|
||||
'horizon:security:security_alarms:index')
|
||||
|
||||
def get_policy_target(self, request, datum=None):
|
||||
project_id = None
|
||||
if datum:
|
||||
project_id = getattr(datum, 'tenant_id', None)
|
||||
return {"project_id": project_id}
|
||||
|
||||
def allowed(self, request, alarm=None):
|
||||
"""Allow terminate action if instance not currently being deleted."""
|
||||
return not(is_associated(alarm)) \
|
||||
and api.cerberus.is_sticks_available(request)
|
||||
|
||||
def action(self, request, alarm_id):
|
||||
alarm = api.cerberus.security_alarm_get(request, alarm_id)
|
||||
if alarm.project_id is not None:
|
||||
data = {'project': alarm.project_id, 'title': alarm.summary}
|
||||
else:
|
||||
data = {'project': 'infra', 'title': alarm.summary}
|
||||
try:
|
||||
ticket = api.cerberus.ticket_create(request, data)
|
||||
api.cerberus.security_alarm_put_ticket_id(request,
|
||||
alarm.alarm_id,
|
||||
ticket.id)
|
||||
except Exception as e:
|
||||
LOG.exception(e)
|
||||
exceptions.handle(request,
|
||||
_("Unable to create ticket."),
|
||||
redirect=self.failure_url)
|
||||
|
||||
|
||||
class ShowTicket(tables.LinkAction):
|
||||
name = "show_ticket"
|
||||
verbose_name = _("Show ticket")
|
||||
url = "horizon:helpdesk:tickets:details"
|
||||
classes = ("btn-edit",)
|
||||
|
||||
def get_policy_target(self, request, datum=None):
|
||||
project_id = None
|
||||
if datum:
|
||||
project_id = getattr(datum, 'tenant_id', None)
|
||||
return {"project_id": project_id}
|
||||
|
||||
def allowed(self, request, alarm=None):
|
||||
"""Allow terminate action if instance not currently being deleted."""
|
||||
return is_associated(alarm)
|
||||
|
||||
def get_link_url(self, alarm=None):
|
||||
return urlresolvers.reverse(self.url, args=(alarm.ticket_id,))
|
||||
|
||||
|
||||
class SecurityAlarmsTable(tables.DataTable):
|
||||
alarm_id = tables.Column("alarm_id",
|
||||
link=("horizon:security:security_alarms:"
|
||||
"details"),
|
||||
verbose_name="id",)
|
||||
summary = tables.Column("summary", verbose_name=_("Summary"))
|
||||
description = tables.Column("description", verbose_name=_("Description"),
|
||||
truncate=30)
|
||||
project_id = tables.Column("project_id", verbose_name=_("Project"))
|
||||
plugin_id = tables.Column("plugin_id", verbose_name=_("Plugin"))
|
||||
received_at = tables.Column("timestamp", verbose_name=_("Received at"))
|
||||
|
||||
def get_object_id(self, datum):
|
||||
return datum.alarm_id
|
||||
|
||||
class Meta:
|
||||
name = "security_alarms"
|
||||
verbose_name = _("Security Alarms")
|
||||
row_actions = (CreateTicket, ShowTicket)
|
@ -1,34 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2015 EUROGICIEL
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from horizon import tabs
|
||||
|
||||
|
||||
class OverviewTab(tabs.Tab):
|
||||
name = _("Overview")
|
||||
slug = "overview"
|
||||
template_name = ("security_alarms/_detail_overview.html")
|
||||
|
||||
def get_context_data(self, request, **kwargs):
|
||||
return {"security_alarm": self.tab_group.kwargs['security_alarm']}
|
||||
|
||||
|
||||
class DetailsTabs(tabs.TabGroup):
|
||||
slug = "security_alarm_details"
|
||||
sticky = True
|
||||
tabs = (OverviewTab,)
|
@ -1,30 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2015 EUROGICIEL
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
from django.conf.urls import patterns
|
||||
from django.conf.urls import url
|
||||
|
||||
import cerberusdashboard.security_alarms.views as views
|
||||
|
||||
|
||||
urlpatterns = patterns('',
|
||||
url(r'^$', views.IndexView.as_view(),
|
||||
name='index'),
|
||||
url(r'^$', views.IndexView.as_view(),
|
||||
name='security_alarms'),
|
||||
url(r'^(?P<alarm_id>[^/]+)$',
|
||||
views.DetailView.as_view(),
|
||||
name='details'),)
|
@ -1,77 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2015 EUROGICIEL
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
import logging
|
||||
|
||||
from django.core.urlresolvers import reverse_lazy
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from horizon import exceptions
|
||||
from horizon import tables
|
||||
from horizon import tabs
|
||||
|
||||
from cerberusdashboard.api import cerberus
|
||||
from cerberusdashboard.security_alarms import tables as s_tables
|
||||
from cerberusdashboard.security_alarms import tabs as s_tabs
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class IndexView(tables.DataTableView):
|
||||
table_class = s_tables.SecurityAlarmsTable
|
||||
template_name = 'security_alarms/index.html'
|
||||
|
||||
def get_data(self):
|
||||
try:
|
||||
security_alarms = cerberus.security_alarm_list(self.request)
|
||||
except Exception:
|
||||
raise
|
||||
return security_alarms
|
||||
|
||||
|
||||
class DetailView(tabs.TabbedTableView):
|
||||
tab_group_class = s_tabs.DetailsTabs
|
||||
template_name = 'security_alarms/detail.html'
|
||||
redirect_url = 'security_alarms:index'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(DetailView, self).get_context_data(**kwargs)
|
||||
context["security_alarm"] = self.get_data()
|
||||
return context
|
||||
|
||||
def get_data(self):
|
||||
alarm_id = self.kwargs['alarm_id']
|
||||
try:
|
||||
security_alarm = cerberus.security_alarm_get(
|
||||
self.request, alarm_id)
|
||||
except Exception as e:
|
||||
LOG.exception(e)
|
||||
redirect = reverse_lazy(self.redirect_url)
|
||||
exceptions.handle(self.request,
|
||||
_('Unable to retrieve details for '
|
||||
'security alarm "%s".') % alarm_id,
|
||||
redirect=redirect)
|
||||
# Not all exception types handled above will result in a redirect.
|
||||
# Need to raise here just in case.
|
||||
raise exceptions.Http302(redirect)
|
||||
|
||||
return security_alarm
|
||||
|
||||
def get_tabs(self, request, *args, **kwargs):
|
||||
security_alarm = self.get_data()
|
||||
return self.tab_group_class(request,
|
||||
security_alarm=security_alarm,
|
||||
**kwargs)
|
@ -1,27 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2015 EUROGICIEL
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
import horizon
|
||||
|
||||
from cerberusdashboard import dashboard
|
||||
|
||||
|
||||
class SecurityReportsPanel(horizon.Panel):
|
||||
name = _("Security Reports")
|
||||
slug = 'security_reports'
|
||||
|
||||
dashboard.Cerberus.register(SecurityReportsPanel)
|
@ -1,141 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2015 EUROGICIEL
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
import logging
|
||||
|
||||
from django.core import urlresolvers
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from horizon import exceptions
|
||||
from horizon import tables
|
||||
|
||||
from cerberusdashboard import api
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def is_associated(report):
|
||||
ticket_id = getattr(report, "ticket_id", None)
|
||||
if not ticket_id:
|
||||
return False
|
||||
else:
|
||||
return True
|
||||
|
||||
|
||||
class CreateTicket(tables.BatchAction):
|
||||
name = "create_ticket"
|
||||
action_present = _("Create")
|
||||
action_past = _("%(data_type)s created")
|
||||
data_type_singular = _("Ticket")
|
||||
data_type_plural = _("Tickets")
|
||||
classes = ('btn-danger', 'btn-terminate')
|
||||
failure_url = urlresolvers.reverse_lazy(
|
||||
'horizon:security:security_reports:index')
|
||||
|
||||
def get_policy_target(self, request, datum=None):
|
||||
project_id = None
|
||||
if datum:
|
||||
project_id = getattr(datum, 'tenant_id', None)
|
||||
return {"project_id": project_id}
|
||||
|
||||
def allowed(self, request, report=None):
|
||||
"""Allow terminate action if instance not currently being deleted."""
|
||||
return not(is_associated(report)) \
|
||||
and api.cerberus.is_sticks_available(request)
|
||||
|
||||
def action(self, request, report_uuid):
|
||||
report = api.cerberus.security_report_get(request, report_uuid)
|
||||
data = {'project': report.project_id, 'title': report.title}
|
||||
try:
|
||||
ticket = api.cerberus.ticket_create(request, data)
|
||||
api.cerberus.security_report_put_ticket_id(request,
|
||||
report_uuid,
|
||||
ticket.id)
|
||||
except Exception as e:
|
||||
LOG.exception(e)
|
||||
exceptions.handle(request,
|
||||
_("Unable to create ticket."),
|
||||
redirect=self.failure_url)
|
||||
|
||||
|
||||
class ShowTicket(tables.LinkAction):
|
||||
name = "show_ticket"
|
||||
verbose_name = _("Show ticket")
|
||||
url = "horizon:helpdesk:tickets:details"
|
||||
classes = ("btn-edit",)
|
||||
|
||||
def get_policy_target(self, request, datum=None):
|
||||
project_id = None
|
||||
if datum:
|
||||
project_id = getattr(datum, 'tenant_id', None)
|
||||
return {"project_id": project_id}
|
||||
|
||||
def allowed(self, request, report=None):
|
||||
"""Allow terminate action if instance not currently being deleted."""
|
||||
return is_associated(report)
|
||||
|
||||
def get_link_url(self, report=None):
|
||||
return urlresolvers.reverse(self.url, args=(report.ticket_id,))
|
||||
|
||||
|
||||
class SecurityReportsTable(tables.DataTable):
|
||||
report_uuid = tables.Column("uuid",
|
||||
link=("horizon:security:security_reports:"
|
||||
"details"),
|
||||
verbose_name="uuid",)
|
||||
title = tables.Column("title", verbose_name=_("Title"))
|
||||
description = tables.Column("description", verbose_name=_("Description"))
|
||||
plugin_id = tables.Column("plugin_id", verbose_name=_("Plugin"))
|
||||
component_name = tables.Column("component_name",
|
||||
verbose_name=_("Component name"))
|
||||
description = tables.Column("description", verbose_name=_("Description"),
|
||||
truncate=30)
|
||||
vulns = tables.Column("vulnerabilities_number",
|
||||
verbose_name=_("Number of vulnerabilities"))
|
||||
security_rating = tables.Column("security_rating",
|
||||
verbose_name=_("Security rating"))
|
||||
last_date = tables.Column("last_report_date", verbose_name=_("Scan date"))
|
||||
project_id = tables.Column("project_id", verbose_name=_("Project"))
|
||||
|
||||
class Meta:
|
||||
name = "security_reports"
|
||||
verbose_name = _("Security Reports")
|
||||
row_actions = (CreateTicket, ShowTicket)
|
||||
|
||||
def get_object_id(self, report):
|
||||
return report.uuid
|
||||
|
||||
|
||||
class VulnerabilitiesTable(tables.DataTable):
|
||||
service = tables.Column("service",
|
||||
verbose_name=_("Service"))
|
||||
|
||||
family = tables.Column("family", verbose_name=_("Family"))
|
||||
|
||||
name = tables.Column("name", verbose_name=_("Name"))
|
||||
|
||||
risk = tables.Column("score",
|
||||
verbose_name=_("Risk"))
|
||||
|
||||
vuln_state = tables.Column('vuln_state',
|
||||
verbose_name=_("State"))
|
||||
|
||||
def get_object_id(self, vulnerability):
|
||||
return vulnerability.get('id', None)
|
||||
|
||||
class Meta:
|
||||
name = "vulnerabilities"
|
||||
verbose_name = _("Vulnerabilities")
|
@ -1,50 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2015 EUROGICIEL
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
import json
|
||||
|
||||
from horizon import tabs
|
||||
|
||||
from cerberusdashboard.security_reports import tables
|
||||
|
||||
|
||||
class OverviewTab(tabs.Tab):
|
||||
name = _("Overview")
|
||||
slug = "overview"
|
||||
template_name = ("security_reports/_detail_overview.html")
|
||||
|
||||
def get_context_data(self, request, **kwargs):
|
||||
return {"security_report": self.tab_group.kwargs['security_report']}
|
||||
|
||||
|
||||
class VulnerabilitiesTab(tabs.TableTab):
|
||||
table_classes = (tables.VulnerabilitiesTable,)
|
||||
name = _("Vulnerabilities")
|
||||
slug = "vulnerabilities"
|
||||
template_name = "horizon/common/_detail_table.html"
|
||||
|
||||
def get_vulnerabilities_data(self):
|
||||
vulnerabilities = self.tab_group.kwargs[
|
||||
'security_report'].vulnerabilities
|
||||
|
||||
return json.loads(vulnerabilities).values()
|
||||
|
||||
|
||||
class DetailsTabs(tabs.TabGroup):
|
||||
slug = "security_report_details"
|
||||
sticky = True
|
||||
tabs = (OverviewTab, VulnerabilitiesTab,)
|
@ -1,30 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2015 EUROGICIEL
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
from django.conf.urls import patterns
|
||||
from django.conf.urls import url
|
||||
|
||||
import cerberusdashboard.security_reports.views as views
|
||||
|
||||
|
||||
urlpatterns = patterns('',
|
||||
url(r'^$', views.IndexView.as_view(),
|
||||
name='index'),
|
||||
url(r'^$', views.IndexView.as_view(),
|
||||
name='security_reports'),
|
||||
url(r'^(?P<report_uuid>[^/]+)$',
|
||||
views.DetailView.as_view(),
|
||||
name='details'),)
|
@ -1,76 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2015 EUROGICIEL
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
import logging
|
||||
|
||||
from django.core.urlresolvers import reverse_lazy
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from horizon import exceptions
|
||||
from horizon import tables
|
||||
from horizon import tabs
|
||||
|
||||
from cerberusdashboard.api import cerberus
|
||||
from cerberusdashboard.security_reports import tables as s_tables
|
||||
from cerberusdashboard.security_reports import tabs as s_tabs
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class IndexView(tables.DataTableView):
|
||||
table_class = s_tables.SecurityReportsTable
|
||||
template_name = 'security_reports/index.html'
|
||||
|
||||
def get_data(self):
|
||||
try:
|
||||
security_reports = cerberus.security_report_list(self.request)
|
||||
except Exception:
|
||||
raise
|
||||
return security_reports
|
||||
|
||||
|
||||
class DetailView(tabs.TabbedTableView):
|
||||
tab_group_class = s_tabs.DetailsTabs
|
||||
template_name = 'security_reports/detail.html'
|
||||
redirect_url = 'horizon/security/security_reports:index'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(DetailView, self).get_context_data(**kwargs)
|
||||
context["security_report"] = self.get_data()
|
||||
return context
|
||||
|
||||
def get_data(self):
|
||||
report_uuid = self.kwargs['report_uuid']
|
||||
try:
|
||||
security_report = cerberus.security_report_get(
|
||||
self.request, report_uuid)
|
||||
except Exception as e:
|
||||
LOG.exception(e)
|
||||
redirect = reverse_lazy(self.redirect_url)
|
||||
exceptions.handle(self.request,
|
||||
_('Unable to retrieve details for '
|
||||
'security report "%s".') % report_uuid,
|
||||
redirect=redirect)
|
||||
# Not all exception types handled above will result in a redirect.
|
||||
# Need to raise here just in case.
|
||||
raise exceptions.Http302(redirect)
|
||||
|
||||
return security_report
|
||||
|
||||
def get_tabs(self, request, *args, **kwargs):
|
||||
security_report = self.get_data()
|
||||
return self.tab_group_class(request,
|
||||
security_report=security_report,
|
||||
**kwargs)
|
@ -1,28 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2015 EUROGICIEL
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
import horizon
|
||||
|
||||
from cerberusdashboard import dashboard
|
||||
|
||||
|
||||
class TasksPanel(horizon.Panel):
|
||||
name = _("Tasks")
|
||||
slug = 'tasks'
|
||||
permissions = ('openstack.roles.admin',)
|
||||
|
||||
dashboard.Cerberus.register(TasksPanel)
|
@ -1,132 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2015 EUROGICIEL
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
import logging
|
||||
|
||||
from django.core import urlresolvers
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from horizon import exceptions
|
||||
from horizon import tables
|
||||
|
||||
from cerberusdashboard import api
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def is_recurrent(task):
|
||||
type = getattr(task, "type", None)
|
||||
if not type:
|
||||
return False
|
||||
return type.lower() == "recurrent"
|
||||
|
||||
|
||||
def is_stopped(task):
|
||||
state = getattr(task, "state", None)
|
||||
if not state:
|
||||
return False
|
||||
return state.lower() == "stopped"
|
||||
|
||||
|
||||
class DeleteTasks(tables.BatchAction):
|
||||
name = "delete"
|
||||
action_present = _("Delete")
|
||||
action_past = _("%(data_type)s deleted")
|
||||
data_type_singular = _("Task")
|
||||
data_type_plural = _("Tasks")
|
||||
classes = ('btn-danger')
|
||||
failure_url = urlresolvers.reverse_lazy(
|
||||
'horizon:security:tasks:index')
|
||||
|
||||
def allowed(self, request, task=None):
|
||||
"""Allow terminate action if instance not currently being deleted."""
|
||||
return is_recurrent(task)
|
||||
|
||||
def action(self, request, obj_id):
|
||||
try:
|
||||
api.cerberus.task_delete(request, obj_id)
|
||||
except Exception as e:
|
||||
LOG.exception(e)
|
||||
exceptions.handle(request,
|
||||
_("Unable to delete ticket."),
|
||||
redirect=self.failure_url)
|
||||
|
||||
|
||||
class RestartTasks(tables.BatchAction):
|
||||
name = "restart"
|
||||
action_present = _("Restart")
|
||||
action_past = _("%(data_type)s restarted")
|
||||
data_type_singular = _("Task")
|
||||
data_type_plural = _("Tasks")
|
||||
classes = ('btn-danger')
|
||||
failure_url = urlresolvers.reverse_lazy(
|
||||
'horizon:security:tasks:index')
|
||||
|
||||
def allowed(self, request, task=None):
|
||||
"""Allow terminate action if instance not currently being deleted."""
|
||||
return is_recurrent(task) and is_stopped(task)
|
||||
|
||||
def action(self, request, obj_id):
|
||||
try:
|
||||
api.cerberus.task_restart(request, obj_id)
|
||||
except Exception as e:
|
||||
LOG.exception(e)
|
||||
exceptions.handle(request,
|
||||
_("Unable to restart ticket."),
|
||||
redirect=self.failure_url)
|
||||
|
||||
|
||||
class StopTasks(tables.BatchAction):
|
||||
name = "stop"
|
||||
action_present = _("Stop")
|
||||
action_past = _("%(data_type)s stopped")
|
||||
data_type_singular = _("Task")
|
||||
data_type_plural = _("Tasks")
|
||||
classes = ('btn-danger', 'btn-terminate')
|
||||
failure_url = urlresolvers.reverse_lazy(
|
||||
'horizon:security:tasks:index')
|
||||
|
||||
def get_policy_target(self, request, datum=None):
|
||||
project_id = None
|
||||
if datum:
|
||||
project_id = getattr(datum, 'tenant_id', None)
|
||||
return {"project_id": project_id}
|
||||
|
||||
def action(self, request, obj_id):
|
||||
try:
|
||||
api.cerberus.task_stop(request, obj_id)
|
||||
except Exception as e:
|
||||
LOG.exception(e)
|
||||
exceptions.handle(request,
|
||||
_("Unable to stop task."),
|
||||
redirect=self.failure_url)
|
||||
|
||||
|
||||
class TasksTable(tables.DataTable):
|
||||
id = tables.Column("id",
|
||||
link=("horizon:security:tasks:details"),
|
||||
verbose_name="id",)
|
||||
name = tables.Column("name", verbose_name=_("Name"))
|
||||
type = tables.Column("type", verbose_name=_("Type"))
|
||||
period = tables.Column("period", verbose_name=_("Period"))
|
||||
state = tables.Column("state", verbose_name=_("State"))
|
||||
plugin_id = tables.Column("plugin_id", verbose_name=_("Plugin"))
|
||||
|
||||
class Meta:
|
||||
name = "tasks"
|
||||
verbose_name = _("Tasks")
|
||||
table_actions = (DeleteTasks, StopTasks, RestartTasks)
|
||||
row_actions = (DeleteTasks, StopTasks, RestartTasks)
|
@ -1,33 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2015 EUROGICIEL
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from horizon import tabs
|
||||
|
||||
|
||||
class OverviewTab(tabs.Tab):
|
||||
name = _("Overview")
|
||||
slug = "overview"
|
||||
template_name = ("tasks/_detail_overview.html")
|
||||
|
||||
def get_context_data(self, request, **kwargs):
|
||||
return {"task": self.tab_group.kwargs['task']}
|
||||
|
||||
|
||||
class DetailsTabs(tabs.TabGroup):
|
||||
slug = "task_details"
|
||||
sticky = True
|
||||
tabs = (OverviewTab,)
|
@ -1,30 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2015 EUROGICIEL
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
from django.conf.urls import patterns
|
||||
from django.conf.urls import url
|
||||
|
||||
import cerberusdashboard.tasks.views as views
|
||||
|
||||
|
||||
urlpatterns = patterns('',
|
||||
url(r'^$', views.IndexView.as_view(),
|
||||
name='index'),
|
||||
url(r'^$', views.IndexView.as_view(),
|
||||
name='tasks'),
|
||||
url(r'^(?P<id>[^/]+)$',
|
||||
views.DetailView.as_view(),
|
||||
name='details'),)
|
@ -1,73 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2015 EUROGICIEL
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
import logging
|
||||
|
||||
from horizon import exceptions
|
||||
from horizon import tables
|
||||
from horizon import tabs
|
||||
|
||||
from cerberusdashboard import api
|
||||
from cerberusdashboard.tasks import tables as t_tables
|
||||
from cerberusdashboard.tasks import tabs as t_tabs
|
||||
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class IndexView(tables.DataTableView):
|
||||
table_class = t_tables.TasksTable
|
||||
template_name = 'tasks/index.html'
|
||||
|
||||
def get_data(self):
|
||||
try:
|
||||
tasks = api.cerberus.task_list(self.request)
|
||||
except Exception:
|
||||
raise
|
||||
return tasks
|
||||
|
||||
|
||||
class DetailView(tabs.TabbedTableView):
|
||||
tab_group_class = t_tabs.DetailsTabs
|
||||
template_name = 'tasks/detail.html'
|
||||
redirect_url = 'horizon:security:tasks:index'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super(DetailView, self).get_context_data(**kwargs)
|
||||
context["task"] = self.get_data()
|
||||
return context
|
||||
|
||||
def get_data(self):
|
||||
id = self.kwargs['id']
|
||||
try:
|
||||
task = api.cerberus.task_get(self.request, id)
|
||||
except Exception as e:
|
||||
LOG.exception(e)
|
||||
redirect = reverse(self.redirect_url)
|
||||
exceptions.handle(self.request,
|
||||
_('Unable to retrieve details for '
|
||||
'task "%s".') % id,
|
||||
redirect=redirect)
|
||||
# Not all exception types handled above will result in a redirect.
|
||||
# Need to raise here just in case.
|
||||
raise exceptions.Http302(redirect)
|
||||
|
||||
return task
|
||||
|
||||
def get_tabs(self, request, *args, **kwargs):
|
||||
task = self.get_data()
|
||||
return self.tab_group_class(request, task=task, **kwargs)
|
@ -1,27 +0,0 @@
|
||||
{% load i18n sizeformat %}
|
||||
{% load url from future %}
|
||||
|
||||
<h3>{% trans "Plugin" %}</h3>
|
||||
|
||||
<div class="status row-fluid detail">
|
||||
<h4>{% trans "Overview" %}</h4>
|
||||
<hr class="header_rule">
|
||||
<dl>
|
||||
<dt>{% trans "Name" %}</dt>
|
||||
<dd>{{plugin.name}}</dd>
|
||||
<dt>{% trans "Version" %}</dt>
|
||||
<dd>{{plugin.version}}</dd>
|
||||
<dt>{% trans "uuid" %}</dt>
|
||||
<dd>{{plugin.uuid}}</dd>
|
||||
<dt>{% trans "Description" %}</dt>
|
||||
<dd>{{plugin.description}}</dd>
|
||||
<dt>{% trans "Subscribed events" %}</dt>
|
||||
{% for event in plugin.subscribed_events %}
|
||||
<dd>{{event}}</dd>
|
||||
{% endfor %}
|
||||
<dt>{% trans "Task methods" %}</dt>
|
||||
{% for method in plugin.methods %}
|
||||
<dd>{{method}}</dd>
|
||||
{% endfor %}
|
||||
</dl>
|
||||
</div>
|
@ -1,15 +0,0 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load i18n sizeformat %}
|
||||
{% block title %}{% trans "Plugin Details" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Plugin Details:")%}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
<div class="row">
|
||||
<div class="span12">
|
||||
{{ tab_group.render }}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
@ -1,11 +0,0 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Plugins" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Plugins") %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
{{ table.render }}
|
||||
{% endblock %}
|
@ -1,28 +0,0 @@
|
||||
{% load i18n sizeformat %}
|
||||
{% load url from future %}
|
||||
|
||||
<h3>{% trans "Security alarm" %}</h3>
|
||||
|
||||
<div class="status row-fluid detail">
|
||||
<h4>{% trans "Overview" %}</h4>
|
||||
<hr class="header_rule">
|
||||
<dl>
|
||||
<dt>{% trans "ID" %}</dt>
|
||||
<dd>{{ security_alarm.id }}</dd>
|
||||
<dt>{% trans "status" %}</dt>
|
||||
<dd>{{ security_alarm.status }}</dd>
|
||||
<dt>{% trans "severity" %}</dt>
|
||||
<dd>{{ security_alarm.severity }}</dd>
|
||||
<dt>{% trans "Summary" %}</dt>
|
||||
<dd>{{ security_alarm.summary }}</dd>
|
||||
<dt>{% trans "Description" %}</dt>
|
||||
<dd>{{ security_alarm.description }}</dd>
|
||||
<dt>{% trans "Component id" %}</dt>
|
||||
<dd>{{ security_alarm.component_id }}</dd>
|
||||
<dt>{% trans "Received at" %}</dt>
|
||||
<dd>{{ security_alarm.timestamp }}</dd>
|
||||
<dt>{% trans "Plugin" %}</dt>
|
||||
<dd><a href="{% url 'horizon:security:plugins:details' security_alarm.plugin_id %}">
|
||||
{{ security_alarm.plugin_id }}</a></dd>
|
||||
</dl>
|
||||
</div>
|
@ -1,15 +0,0 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load i18n sizeformat %}
|
||||
{% block title %}{% trans "Security Alarm Details" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Security Alarm Details: ")|add:security_alarm.id %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
<div class="row">
|
||||
<div class="span12">
|
||||
{{ tab_group.render }}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
@ -1,11 +0,0 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Security Alarms" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Security Alarms") %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
{{ table.render }}
|
||||
{% endblock %}
|
@ -1,43 +0,0 @@
|
||||
{% load i18n sizeformat %}
|
||||
{% load url from future %}
|
||||
|
||||
<h3>{% trans "Security report" %}</h3>
|
||||
|
||||
<div class="status row-fluid detail">
|
||||
<h4>{% trans "Overview" %}</h4>
|
||||
<hr class="header_rule">
|
||||
<dl>
|
||||
<dt>{% trans "ID" %}</dt>
|
||||
<dd>{{ security_report.uuid }}</dd>
|
||||
<dt>{% trans "Title" %}</dt>
|
||||
<dd>{{ security_report.title }}</dd>
|
||||
<dt>{% trans "Description" %}</dt>
|
||||
<dd>{{ security_report.description }}</dd>
|
||||
<dt>{% trans "Component type" %}</dt>
|
||||
<dd>{{ security_report.component_type }}</dd>
|
||||
{% if security_report.component_type == 'instance' %}
|
||||
{% url 'horizon:project:instances:detail' security_report.component_id as component_url %}
|
||||
{% endif %}
|
||||
<dt>{% trans "Component id" %}</dt>
|
||||
<dd>
|
||||
{% if security_report.component_type == 'instance' %}
|
||||
<a href="{{ component_url }}">{{ security_report.component_id }}</a>
|
||||
{% else %}
|
||||
{{ security_report.component_id }}
|
||||
{% endif %}
|
||||
|
||||
</dd>
|
||||
<dt>{% trans "Security rating" %}</dt>
|
||||
<dd>{{ security_report.security_rating }}</dd>
|
||||
<dt>{% trans "Plugin" %}</dt>
|
||||
<dd><a href="{% url 'horizon:security:plugins:details' security_report.plugin_id %}">
|
||||
{{ security_report.plugin_id }}</a></dd>
|
||||
<dt>{% trans "Report id of the plugin" %}</dt>
|
||||
<dd>{{ security_report.report_id }}</dd>
|
||||
<dt>{% trans "Associated ticket" %}</dt>
|
||||
{% if security_report.ticket_id != None %}
|
||||
<dd><a href="{% url 'horizon:helpdesk:tickets:details' security_report.ticket_id %}">
|
||||
{{ security_report.ticket_id }}</a></dd>
|
||||
{% endif %}
|
||||
</dl>
|
||||
</div>
|
@ -1,15 +0,0 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load i18n sizeformat %}
|
||||
{% block title %}{% trans "Security Report Details" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Security Report Details: ")|add:security_report.uuid %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
<div class="row">
|
||||
<div class="span12">
|
||||
{{ tab_group.render }}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
@ -1,11 +0,0 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Security Reports" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Security Reports") %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
{{ table.render }}
|
||||
{% endblock %}
|
@ -1,19 +0,0 @@
|
||||
{% load i18n sizeformat %}
|
||||
{% load url from future %}
|
||||
|
||||
<h3>{% trans "Task" %}</h3>
|
||||
|
||||
<div class="status row-fluid detail">
|
||||
<h4>{% trans "Overview" %}</h4>
|
||||
<hr class="header_rule">
|
||||
<dl>
|
||||
<dt>{% trans "ID" %}</dt>
|
||||
<dd>{{ task.id }}</dd>
|
||||
<dt>{% trans "Type" %}</dt>
|
||||
<dd>{{ task.type }}</dd>
|
||||
<dt>{% trans "Plugin" %}</dt>
|
||||
<dd><a href="{% url 'horizon:security:plugins:details' task.plugin_id %}">{{ task.plugin_id }}</a></dd>
|
||||
<dt>{% trans "State" %}</dt>
|
||||
<dd>{{ task.state }}</dd>
|
||||
</dl>
|
||||
</div>
|
@ -1,15 +0,0 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load i18n sizeformat %}
|
||||
{% block title %}{% trans "Task Details" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Task Details:") %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
<div class="row">
|
||||
<div class="span12">
|
||||
{{ tab_group.render }}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
@ -1,11 +0,0 @@
|
||||
{% extends 'base.html' %}
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Tasks" %}{% endblock %}
|
||||
|
||||
{% block page_header %}
|
||||
{% include "horizon/common/_page_header.html" with title=_("Tasks") %}
|
||||
{% endblock page_header %}
|
||||
|
||||
{% block main %}
|
||||
{{ table.render }}
|
||||
{% endblock %}
|
@ -1,23 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright 2010-2011 OpenStack Foundation
|
||||
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from oslotest import base
|
||||
|
||||
|
||||
class TestCase(base.BaseTestCase):
|
||||
|
||||
"""Test case base class for all unit tests."""
|
@ -1,28 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
"""
|
||||
test_cerberus-dashboard
|
||||
----------------------------------
|
||||
|
||||
Tests for `cerberus-dashboard` module.
|
||||
"""
|
||||
|
||||
from cerberusdashboard.tests import base
|
||||
|
||||
|
||||
class TestCerberusDashboard(base.TestCase):
|
||||
|
||||
def test_something(self):
|
||||
pass
|
@ -1,30 +0,0 @@
|
||||
#
|
||||
# Copyright (c) 2015 EUROGICIEL
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may
|
||||
# not use this file except in compliance with the License. You may obtain
|
||||
# a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
from cerberusdashboard.openstack.common import importutils
|
||||
|
||||
|
||||
def import_any(*args):
|
||||
if not args:
|
||||
raise RuntimeError('No module is specified for import')
|
||||
|
||||
for module_name in args:
|
||||
module = importutils.try_import(module_name)
|
||||
if module is not None:
|
||||
return module
|
||||
|
||||
raise RuntimeError('Unable to import any modules from the list %s' %
|
||||
str(args))
|
@ -1,75 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
sys.path.insert(0, os.path.abspath('../..'))
|
||||
# -- General configuration ----------------------------------------------------
|
||||
|
||||
# Add any Sphinx extension module names here, as strings. They can be
|
||||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
|
||||
extensions = [
|
||||
'sphinx.ext.autodoc',
|
||||
#'sphinx.ext.intersphinx',
|
||||
'oslosphinx'
|
||||
]
|
||||
|
||||
# autodoc generation is a bit aggressive and a nuisance when doing heavy
|
||||
# text edit cycles.
|
||||
# execute "export SPHINX_DEBUG=1" in your terminal to disable
|
||||
|
||||
# The suffix of source filenames.
|
||||
source_suffix = '.rst'
|
||||
|
||||
# The master toctree document.
|
||||
master_doc = 'index'
|
||||
|
||||
# General information about the project.
|
||||
project = u'cerberus-dashboard'
|
||||
copyright = u'2013, OpenStack Foundation'
|
||||
|
||||
# If true, '()' will be appended to :func: etc. cross-reference text.
|
||||
add_function_parentheses = True
|
||||
|
||||
# If true, the current module name will be prepended to all description
|
||||
# unit titles (such as .. function::).
|
||||
add_module_names = True
|
||||
|
||||
# The name of the Pygments (syntax highlighting) style to use.
|
||||
pygments_style = 'sphinx'
|
||||
|
||||
# -- Options for HTML output --------------------------------------------------
|
||||
|
||||
# The theme to use for HTML and HTML Help pages. Major themes that come with
|
||||
# Sphinx are currently 'default' and 'sphinxdoc'.
|
||||
# html_theme_path = ["."]
|
||||
# html_theme = '_theme'
|
||||
# html_static_path = ['static']
|
||||
|
||||
# Output file base name for HTML help builder.
|
||||
htmlhelp_basename = '%sdoc' % project
|
||||
|
||||
# Grouping the document tree into LaTeX files. List of tuples
|
||||
# (source start file, target name, title, author, documentclass
|
||||
# [howto/manual]).
|
||||
latex_documents = [
|
||||
('index',
|
||||
'%s.tex' % project,
|
||||
u'%s Documentation' % project,
|
||||
u'OpenStack Foundation', 'manual'),
|
||||
]
|
||||
|
||||
# Example configuration for intersphinx: refer to the Python standard library.
|
||||
#intersphinx_mapping = {'http://docs.python.org/': None}
|
@ -1,4 +0,0 @@
|
||||
============
|
||||
Contributing
|
||||
============
|
||||
.. include:: ../../CONTRIBUTING.rst
|
@ -1,25 +0,0 @@
|
||||
.. cerberus-dashboard documentation master file, created by
|
||||
sphinx-quickstart on Tue Jul 9 22:26:36 2013.
|
||||
You can adapt this file completely to your liking, but it should at least
|
||||
contain the root `toctree` directive.
|
||||
|
||||
Welcome to cerberus-dashboard's documentation!
|
||||
========================================================
|
||||
|
||||
Contents:
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
|
||||
readme
|
||||
installation
|
||||
usage
|
||||
contributing
|
||||
|
||||
Indices and tables
|
||||
==================
|
||||
|
||||
* :ref:`genindex`
|
||||
* :ref:`modindex`
|
||||
* :ref:`search`
|
||||
|
@ -1,12 +0,0 @@
|
||||
============
|
||||
Installation
|
||||
============
|
||||
|
||||
At the command line::
|
||||
|
||||
$ pip install cerberus-dashboard
|
||||
|
||||
Or, if you have virtualenvwrapper installed::
|
||||
|
||||
$ mkvirtualenv cerberus-dashboard
|
||||
$ pip install cerberus-dashboard
|
@ -1 +0,0 @@
|
||||
.. include:: ../../README.rst
|
@ -1,7 +0,0 @@
|
||||
========
|
||||
Usage
|
||||
========
|
||||
|
||||
To use cerberus-dashboard in a project::
|
||||
|
||||
import cerberus-dashboard
|
@ -1,6 +0,0 @@
|
||||
[DEFAULT]
|
||||
|
||||
# The list of modules to copy from oslo-incubator.git
|
||||
|
||||
# The base module to hold the copy of openstack.common
|
||||
base=cerberusdashboard
|
@ -1,6 +0,0 @@
|
||||
# The order of packages is significant, because pip processes them in the order
|
||||
# of appearance. Changing the order has an impact on the overall integration
|
||||
# process, which may cause wedges in the gate later.
|
||||
|
||||
pbr>=0.6,!=0.7,<1.0
|
||||
Babel>=1.3
|
47
setup.cfg
47
setup.cfg
@ -1,47 +0,0 @@
|
||||
[metadata]
|
||||
name = cerberus-dashboard
|
||||
summary = Dashboard for Openstack Cerberus
|
||||
description-file =
|
||||
README.rst
|
||||
author = OpenStack
|
||||
author-email = openstack-dev@lists.openstack.org
|
||||
home-page = http://www.openstack.org/
|
||||
classifier =
|
||||
Environment :: OpenStack
|
||||
Intended Audience :: Information Technology
|
||||
Intended Audience :: System Administrators
|
||||
License :: OSI Approved :: Apache Software License
|
||||
Operating System :: POSIX :: Linux
|
||||
Programming Language :: Python
|
||||
Programming Language :: Python :: 2
|
||||
Programming Language :: Python :: 2.7
|
||||
Programming Language :: Python :: 2.6
|
||||
Programming Language :: Python :: 3
|
||||
Programming Language :: Python :: 3.3
|
||||
Programming Language :: Python :: 3.4
|
||||
|
||||
[files]
|
||||
packages =
|
||||
cerberusdashboard
|
||||
|
||||
[build_sphinx]
|
||||
source-dir = doc/source
|
||||
build-dir = doc/build
|
||||
all_files = 1
|
||||
|
||||
[upload_sphinx]
|
||||
upload-dir = doc/build/html
|
||||
|
||||
[compile_catalog]
|
||||
directory = cerberus-dashboard/locale
|
||||
domain = cerberus-dashboard
|
||||
|
||||
[update_catalog]
|
||||
domain = cerberus-dashboard
|
||||
output_dir = cerberus-dashboard/locale
|
||||
input_file = cerberus-dashboard/locale/cerberus-dashboard.pot
|
||||
|
||||
[extract_messages]
|
||||
keywords = _ gettext ngettext l_ lazy_gettext
|
||||
mapping_file = babel.cfg
|
||||
output_file = cerberus-dashboard/locale/cerberus-dashboard.pot
|
30
setup.py
30
setup.py
@ -1,30 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
# implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# THIS FILE IS MANAGED BY THE GLOBAL REQUIREMENTS REPO - DO NOT EDIT
|
||||
import setuptools
|
||||
|
||||
# In python < 2.7.4, a lazy loading of package `pbr` will break
|
||||
# setuptools if some other modules registered functions in `atexit`.
|
||||
# solution from: http://bugs.python.org/issue15881#msg170215
|
||||
try:
|
||||
import multiprocessing # noqa
|
||||
except ImportError:
|
||||
pass
|
||||
|
||||
setuptools.setup(
|
||||
setup_requires=['pbr'],
|
||||
pbr=True)
|
@ -1,16 +0,0 @@
|
||||
# The order of packages is significant, because pip processes them in the order
|
||||
# of appearance. Changing the order has an impact on the overall integration
|
||||
# process, which may cause wedges in the gate later.
|
||||
|
||||
hacking<0.11,>=0.10.0
|
||||
|
||||
coverage>=3.6
|
||||
discover
|
||||
python-subunit>=0.0.18
|
||||
oslotest>=1.2.0 # Apache-2.0
|
||||
testrepository>=0.0.18
|
||||
testscenarios>=0.4
|
||||
testtools>=0.9.36,!=1.2.0
|
||||
# Doc requirements
|
||||
sphinx>=1.1.2,<1.1.999
|
||||
oslosphinx<=2.5.0
|
35
tox.ini
35
tox.ini
@ -1,35 +0,0 @@
|
||||
[tox]
|
||||
minversion = 1.6
|
||||
envlist = py33,py34,py26,py27,pypy,pep8
|
||||
skipsdist = True
|
||||
|
||||
[testenv]
|
||||
usedevelop = True
|
||||
install_command = pip install -U {opts} {packages}
|
||||
setenv =
|
||||
VIRTUAL_ENV={envdir}
|
||||
deps = -r{toxinidir}/requirements.txt
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
|
||||
[testenv:pep8]
|
||||
commands = flake8
|
||||
|
||||
[testenv:venv]
|
||||
commands = {posargs}
|
||||
|
||||
[testenv:cover]
|
||||
commands =
|
||||
nosetests --with-xunit --with-xcoverage --cover-package=cerberus --nocapture --cover-tests --cover-branches --cover-min-percentage=50
|
||||
|
||||
[testenv:docs]
|
||||
commands = python setup.py build_sphinx
|
||||
|
||||
[testenv:debug]
|
||||
commands = oslo_debug_helper {posargs}
|
||||
|
||||
[flake8]
|
||||
|
||||
show-source = True
|
||||
ignore = H101,H238,H302,H803
|
||||
builtins = _
|
||||
exclude=.venv,.git,.tox,dist,doc,*openstack/common*,*lib/python*,*egg,build
|
Loading…
Reference in New Issue
Block a user