Retire craton-dashboard
Remove everything, add a README with explanation. Change-Id: I37f11272c321822065482283e1421898c30d87fc
This commit is contained in:
parent
8babaca289
commit
a73465c631
51
.eslintrc
51
.eslintrc
|
@ -1,51 +0,0 @@
|
|||
# Set up globals
|
||||
globals:
|
||||
angular: false
|
||||
|
||||
extends: openstack
|
||||
|
||||
# Most environment options are not explicitly enabled or disabled, only
|
||||
# included here for completeness' sake. They are commented out, because the
|
||||
# global updates.py script would otherwise override them during a global
|
||||
# requirements synchronization.
|
||||
#
|
||||
# Individual projects should choose which platforms they deploy to.
|
||||
|
||||
env:
|
||||
# browser global variables.
|
||||
browser: true
|
||||
|
||||
# Adds all of the Jasmine testing global variables for version 1.3 and 2.0.
|
||||
jasmine: true
|
||||
|
||||
|
||||
# Below we adjust rules specific to horizon's usage of openstack's linting
|
||||
# rules, and its own plugin inclusions.
|
||||
rules:
|
||||
#############################################################################
|
||||
# Disabled Rules from eslint-config-openstack
|
||||
#############################################################################
|
||||
valid-jsdoc: [1, {
|
||||
requireParamDescription: false
|
||||
}]
|
||||
no-undefined: 1
|
||||
brace-style: 1
|
||||
no-extra-parens: 1
|
||||
callback-return: 1
|
||||
block-scoped-var: 1
|
||||
quote-props: 0
|
||||
space-in-parens: 1
|
||||
no-use-before-define: 1
|
||||
no-unneeded-ternary: 1
|
||||
|
||||
#############################################################################
|
||||
# Angular Plugin Customization
|
||||
#############################################################################
|
||||
|
||||
angular/controller-as-vm:
|
||||
- 1
|
||||
- "ctrl"
|
||||
|
||||
# Remove after migrating to angular 1.4 or later.
|
||||
angular/no-cookiestore:
|
||||
- 1
|
|
@ -1,12 +0,0 @@
|
|||
*.egg*
|
||||
*.mo
|
||||
*.pyc
|
||||
.venv
|
||||
dist
|
||||
ChangeLog
|
||||
AUTHORS
|
||||
craton_ui.egg-info/*
|
||||
node_modules/*
|
||||
.cache
|
||||
.testrepository
|
||||
.tox
|
|
@ -1,4 +0,0 @@
|
|||
[gerrit]
|
||||
host=review.openstack.org
|
||||
port=29418
|
||||
project=openstack/craton-dashboard.git
|
|
@ -1,7 +0,0 @@
|
|||
[DEFAULT]
|
||||
test_command=OS_STDOUT_CAPTURE=${OS_STDOUT_CAPTURE:-1} \
|
||||
OS_STDERR_CAPTURE=${OS_STDERR_CAPTURE:-1} \
|
||||
OS_TEST_TIMEOUT=${OS_TEST_TIMEOUT:-60} \
|
||||
${PYTHON:-python} -m subunit.run discover -t ./ . $LISTOPT $IDOPTION
|
||||
test_id_option=--load-list $IDFILE
|
||||
test_list_option=--list
|
16
.travis.yml
16
.travis.yml
|
@ -1,16 +0,0 @@
|
|||
sudo: false
|
||||
language: python
|
||||
|
||||
matrix:
|
||||
include:
|
||||
- python: 2.7
|
||||
env: TOXENV=py27
|
||||
- python: 3.4
|
||||
env: TOXENV=py34
|
||||
- python: 3.5
|
||||
env: TOXENV=py35
|
||||
- env: TOXENV=pep8
|
||||
|
||||
install: pip install tox-travis
|
||||
|
||||
script: tox
|
6
AUTHORS
6
AUTHORS
|
@ -1,6 +0,0 @@
|
|||
Chris Spencer <christopher.m.spencer@intel.com>
|
||||
Eddie Ramirez <djedi.r@gmail.com>
|
||||
Eddie Ramirez <eddie.ramirez@intel.com>
|
||||
Luis Daniel Castellanos <luis.daniel.castellanos@intel.com>
|
||||
Revon Mathews <revon.mathews@intel.com>
|
||||
ldcastell <luis.daniel.castellanos@intel.com>
|
22
ChangeLog
22
ChangeLog
|
@ -1,22 +0,0 @@
|
|||
CHANGES
|
||||
=======
|
||||
|
||||
* Added regions resource table to the Inventory panel
|
||||
* Directory for i18n
|
||||
* Reordered panels
|
||||
* Add JavaScript unit tests code base
|
||||
* Move the panel dashboard outside of the project section
|
||||
* Removed the docstrings from the start of file
|
||||
* Removed PEP8 errors
|
||||
* More files to ignore
|
||||
* [WIP] Added code base for unit testing and code refactoring
|
||||
* Added some files and stuff
|
||||
* dummy test
|
||||
* added test
|
||||
* Added travis conf file
|
||||
* Updated enable files and install instructions
|
||||
* Added base methods and classes for API
|
||||
* Added base .gitignore
|
||||
* Added regions panel
|
||||
* Initial Structure
|
||||
* Initial commit
|
201
LICENSE
201
LICENSE
|
@ -1,201 +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.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "{}"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright {yyyy} {name of copyright owner}
|
||||
|
||||
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.
|
|
@ -1,3 +0,0 @@
|
|||
include setup.py
|
||||
|
||||
recursive-include craton_dashboard *.js *.html *.scss
|
33
README.rst
33
README.rst
|
@ -1,27 +1,10 @@
|
|||
===============================
|
||||
Craton UI for Horizon Dashboard
|
||||
===============================
|
||||
This project is no longer maintained.
|
||||
|
||||
Test
|
||||
----
|
||||
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".
|
||||
|
||||
* Python tests: ``./run_test.sh``
|
||||
* JS tests:
|
||||
|
||||
1. ``npm install`` (first do ``./run_tests.sh`` to create virtual environment)
|
||||
2. ``npm run lint`` for eslint
|
||||
3. ``npm run test`` for JS unit tests
|
||||
|
||||
Install
|
||||
-------
|
||||
|
||||
From http://docs.openstack.org/developer/horizon/tutorials/plugin.html
|
||||
|
||||
* plugin is the location of your plugin
|
||||
* horizon is the location of horizon
|
||||
* package is the complete name of your packaged plugin
|
||||
|
||||
1. Run “cd plugin & python setup.py sdist”
|
||||
2. Run “cp -rv enabled horizon/openstack_dashboard/local/”
|
||||
3. Run “horizon/tools/with_venv.sh pip install dist/package.tar.gz”
|
||||
4. Restart Apache or your Django test server
|
||||
For any further questions, please email
|
||||
openstack-dev@lists.openstack.org or join #openstack-dev on
|
||||
Freenode.
|
||||
|
|
|
@ -1,150 +0,0 @@
|
|||
# Copyright 2016 Intel Corporation
|
||||
#
|
||||
# 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 cratonclient import session as craton_session # noqa
|
||||
from cratonclient.v1 import client as craton_client # noqa
|
||||
|
||||
from horizon.utils.memoized import memoized # noqa
|
||||
from horizon.utils.memoized import memoized_with_request # noqa
|
||||
|
||||
from openstack_dashboard.api import base # noqa
|
||||
|
||||
|
||||
def get_auth_params_from_request(request):
|
||||
return(
|
||||
request.user.username,
|
||||
request.user.token.id,
|
||||
request.user.tenant_id,
|
||||
base.url_for(request, 'fleetmanagement'),
|
||||
request.session
|
||||
)
|
||||
|
||||
|
||||
@memoized_with_request(get_auth_params_from_request)
|
||||
def cratonclient(request_auth_params):
|
||||
username, token, project_id, url, session = request_auth_params
|
||||
|
||||
session = craton_session.Session(session=session,
|
||||
username=username,
|
||||
token=token)
|
||||
c = craton_client.Client(session=session, url=url)
|
||||
return c
|
||||
|
||||
|
||||
def project_create(request, **kwargs):
|
||||
pass
|
||||
|
||||
|
||||
def project_delete(request, **kwargs):
|
||||
pass
|
||||
|
||||
|
||||
def project_list(request, **kwargs):
|
||||
pass
|
||||
|
||||
|
||||
def project_show(request, **kwargs):
|
||||
pass
|
||||
|
||||
|
||||
def project_update(request, **kwargs):
|
||||
pass
|
||||
|
||||
|
||||
def region_create(request, **kwargs):
|
||||
pass
|
||||
|
||||
|
||||
def region_delete(request, **kwargs):
|
||||
pass
|
||||
|
||||
|
||||
@memoized
|
||||
def region_list(request, **kwargs):
|
||||
return cratonclient(request).regions.list(**kwargs)
|
||||
|
||||
|
||||
def region_show(request, **kwargs):
|
||||
pass
|
||||
|
||||
|
||||
def region_update(request, **kwargs):
|
||||
pass
|
||||
|
||||
|
||||
def cell_create(request, **kwargs):
|
||||
pass
|
||||
|
||||
|
||||
def cell_delete(request, **kwargs):
|
||||
pass
|
||||
|
||||
|
||||
def cell_list(request, **kwargs):
|
||||
pass
|
||||
|
||||
|
||||
def cell_show(request, **kwargs):
|
||||
pass
|
||||
|
||||
|
||||
def cell_update(request, **kwargs):
|
||||
pass
|
||||
|
||||
|
||||
def device_create(request, **kwargs):
|
||||
pass
|
||||
|
||||
|
||||
def device_delete(request, **kwargs):
|
||||
pass
|
||||
|
||||
|
||||
def device_list(request, **kwargs):
|
||||
pass
|
||||
|
||||
|
||||
def device_show(request, **kwargs):
|
||||
pass
|
||||
|
||||
|
||||
def host_create(request, **kwargs):
|
||||
pass
|
||||
|
||||
|
||||
def host_delete(request, **kwargs):
|
||||
pass
|
||||
|
||||
|
||||
@memoized
|
||||
def host_list(request, **kwargs):
|
||||
project_id = getattr(kwargs, 'project_id', None)
|
||||
if project_id:
|
||||
delattr(kwargs, 'project_id')
|
||||
return cratonclient(request).hosts.list(project_id=project_id,
|
||||
**kwargs)
|
||||
return []
|
||||
|
||||
|
||||
def host_show(request, **kwargs):
|
||||
pass
|
||||
|
||||
|
||||
def host_update(request, **kwargs):
|
||||
pass
|
||||
|
||||
|
||||
def user_list(request, **kwargs):
|
||||
pass
|
|
@ -1,15 +0,0 @@
|
|||
# Copyright 2016 Intel Corporation
|
||||
#
|
||||
# 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 craton_dashboard.api.rest import craton # noqa
|
|
@ -1,103 +0,0 @@
|
|||
# Copyright 2016 Intel Corporation
|
||||
#
|
||||
# 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.views import generic
|
||||
|
||||
from craton_dashboard.api import craton
|
||||
|
||||
from openstack_dashboard.api.rest import urls
|
||||
from openstack_dashboard.api.rest import utils as rest_utils
|
||||
|
||||
|
||||
@urls.register
|
||||
class Regions(generic.View):
|
||||
"""API for craton."""
|
||||
|
||||
url_regex = r'craton/regions/$'
|
||||
|
||||
@rest_utils.ajax()
|
||||
def get(self, request, **kwargs):
|
||||
"""Get all Regions."""
|
||||
regions = craton.region_list(request, **kwargs)
|
||||
return {'items': regions}
|
||||
|
||||
@rest_utils.ajax()
|
||||
def post(self, request, **kwargs):
|
||||
"""Create a new Region."""
|
||||
return craton.region_create(request)
|
||||
|
||||
@rest_utils.ajax()
|
||||
def put(self, request, **kwargs):
|
||||
"""Update a Region."""
|
||||
return craton.region_update(request)
|
||||
|
||||
@rest_utils.ajax()
|
||||
def delete(self, request, **kwargs):
|
||||
"""Delete a Region."""
|
||||
return craton.region_delete(request)
|
||||
|
||||
|
||||
@urls.register
|
||||
class Cells(generic.View):
|
||||
"""API for craton."""
|
||||
|
||||
url_regex = r'craton/cells/$'
|
||||
|
||||
@rest_utils.ajax()
|
||||
def get(self, request, **kwargs):
|
||||
"""Get all Cells."""
|
||||
return craton.cell_list(request)
|
||||
|
||||
@rest_utils.ajax()
|
||||
def post(self, request, **kwargs):
|
||||
"""Create a new Cell."""
|
||||
return craton.cell_create(request)
|
||||
|
||||
@rest_utils.ajax()
|
||||
def put(self, request, **kwargs):
|
||||
"""Update a Cell."""
|
||||
return craton.cell_update(request)
|
||||
|
||||
@rest_utils.ajax()
|
||||
def delete(self, request, **kwargs):
|
||||
"""Delete a Cell."""
|
||||
return craton.cell_delete(request)
|
||||
|
||||
|
||||
@urls.register
|
||||
class Hosts(generic.View):
|
||||
"""API for craton."""
|
||||
|
||||
url_regex = r'craton/hosts/$'
|
||||
|
||||
@rest_utils.ajax()
|
||||
def get(self, request, **kwargs):
|
||||
"""Get all Hosts."""
|
||||
return craton.host_list(request)
|
||||
|
||||
@rest_utils.ajax()
|
||||
def post(self, request, **kwargs):
|
||||
"""Create a new Host."""
|
||||
return craton.hosts_create(request)
|
||||
|
||||
@rest_utils.ajax()
|
||||
def put(self, request, **kwargs):
|
||||
"""Update a Host."""
|
||||
return craton.hosts_update(request)
|
||||
|
||||
@rest_utils.ajax()
|
||||
def delete(self, request, **kwargs):
|
||||
"""Delete a Host."""
|
||||
return craton.hosts_delete(request)
|
|
@ -1,15 +0,0 @@
|
|||
# Copyright 2016 Intel Corporation
|
||||
#
|
||||
# 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 craton_dashboard.api import rest # noqa
|
|
@ -1,25 +0,0 @@
|
|||
# Copyright 2016 Intel Corporation
|
||||
#
|
||||
# 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 craton_dashboard import dashboard
|
||||
import horizon
|
||||
|
||||
|
||||
class Inventory(horizon.Panel):
|
||||
name = _('Inventory')
|
||||
slug = 'inventory'
|
||||
|
||||
dashboard.FleetManagement.register(Inventory)
|
|
@ -1,14 +0,0 @@
|
|||
{% extends 'base.html' %}
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Craton" %}{% endblock %}
|
||||
{% block page_header %}{% endblock %}
|
||||
|
||||
{% block ng_route_base %}
|
||||
<base href="{{ WEBROOT }}">
|
||||
{% endblock %}
|
||||
|
||||
{% block main %}
|
||||
<ng-include
|
||||
src="'{{ STATIC_URL }}dashboard/project/fleet_management/inventory/index.html'">
|
||||
</ng-include>
|
||||
{% endblock %}
|
|
@ -1,22 +0,0 @@
|
|||
# Copyright 2016 Intel Corporation
|
||||
#
|
||||
# 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 url
|
||||
|
||||
from craton_dashboard.content.fleet_management.inventory import views
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^$', views.IndexView.as_view(), name='index'),
|
||||
]
|
|
@ -1,21 +0,0 @@
|
|||
# Copyright 2016 Intel Corporation
|
||||
#
|
||||
# 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 django.views import generic
|
||||
|
||||
|
||||
class IndexView(generic.TemplateView):
|
||||
template_name = 'angular.html'
|
||||
page_title = _('Inventory')
|
|
@ -1,15 +0,0 @@
|
|||
# Copyright 2016 Intel Corporation
|
||||
#
|
||||
# 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 craton_dashboard.api import rest # noqa
|
|
@ -1,22 +0,0 @@
|
|||
# Copyright 2016 Intel Corporation
|
||||
#
|
||||
# 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
|
||||
|
||||
|
||||
class Taskflows(horizon.Panel):
|
||||
name = _('Taskflows')
|
||||
slug = 'taskflows'
|
|
@ -1,14 +0,0 @@
|
|||
{% extends 'base.html' %}
|
||||
{% load i18n %}
|
||||
{% block title %}{% trans "Craton" %}{% endblock %}
|
||||
{% block page_header %}{% endblock %}
|
||||
|
||||
{% block ng_route_base %}
|
||||
<base href="{{ WEBROOT }}">
|
||||
{% endblock %}
|
||||
|
||||
{% block main %}
|
||||
<ng-include
|
||||
src="'{{ STATIC_URL }}dashboard/project/fleet_management/taskflows/index.html'">
|
||||
</ng-include>
|
||||
{% endblock %}
|
|
@ -1,22 +0,0 @@
|
|||
# Copyright 2016 Intel Corporation
|
||||
#
|
||||
# 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 url
|
||||
|
||||
from craton_dashboard.content.fleet_management.taskflows import views
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^$', views.IndexView.as_view(), name='index'),
|
||||
]
|
|
@ -1,21 +0,0 @@
|
|||
# Copyright 2016 Intel Corporation
|
||||
#
|
||||
# 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 django.views import generic
|
||||
|
||||
|
||||
class IndexView(generic.TemplateView):
|
||||
template_name = 'angular.html'
|
||||
page_title = _('Taskflows')
|
|
@ -1,25 +0,0 @@
|
|||
# Copyright 2016 Intel Corporation
|
||||
#
|
||||
# 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
|
||||
|
||||
|
||||
class FleetManagement(horizon.Dashboard):
|
||||
name = _("Fleet Management")
|
||||
slug = "fleet_management"
|
||||
default_panel = 'inventory'
|
||||
|
||||
horizon.register(FleetManagement)
|
|
@ -1,24 +0,0 @@
|
|||
# Copyright 2016 Intel Corporation
|
||||
#
|
||||
# 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.
|
||||
|
||||
# The slug of the dashboard to be added to HORIZON['dashboards']. Required.
|
||||
DASHBOARD = 'fleet_management'
|
||||
# A dictionary of exception classes to be added to HORIZON['exceptions'].
|
||||
ADD_EXCEPTIONS = {}
|
||||
# A list of applications to be added to INSTALLED_APPS.
|
||||
ADD_INSTALLED_APPS = ['craton_dashboard', ]
|
||||
|
||||
ADD_ANGULAR_MODULES = ['horizon.dashboard.project.fleet_management']
|
||||
|
||||
AUTO_DISCOVER_STATIC_FILES = True
|
|
@ -1,23 +0,0 @@
|
|||
# Copyright 2016 Intel Corporation
|
||||
#
|
||||
# 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.
|
||||
|
||||
|
||||
PANEL = 'inventory'
|
||||
|
||||
PANEL_DASHBOARD = 'fleet_management'
|
||||
|
||||
PANEL_GROUP = 'default'
|
||||
|
||||
ADD_PANEL = (
|
||||
'craton_dashboard.content.fleet_management.inventory.panel.Inventory')
|
|
@ -1,23 +0,0 @@
|
|||
# Copyright 2016 Intel Corporation
|
||||
#
|
||||
# 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.
|
||||
|
||||
|
||||
PANEL = 'taskflows'
|
||||
|
||||
PANEL_DASHBOARD = 'fleet_management'
|
||||
|
||||
PANEL_GROUP = 'default'
|
||||
|
||||
ADD_PANEL = (
|
||||
'craton_dashboard.content.fleet_management.taskflows.panel.Taskflows')
|
|
@ -1,89 +0,0 @@
|
|||
/**
|
||||
* Copyright 2016 Intel Corporation
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @ngdoc service
|
||||
* @name cratonAPI
|
||||
* @param {Object} apiService
|
||||
* @param {Object} toastService
|
||||
* @description provides direct pass through craton with NO abstraction
|
||||
* @returns {Object} the service
|
||||
*/
|
||||
|
||||
angular
|
||||
.module('horizon.app.core.openstack-service-api')
|
||||
.factory('horizon.app.core.openstack-service-api.craton', cratonAPI);
|
||||
|
||||
cratonAPI.$inject = [
|
||||
'$q',
|
||||
'horizon.framework.util.http.service',
|
||||
'horizon.framework.widgets.toast.service'
|
||||
];
|
||||
|
||||
function cratonAPI($q, apiService, toastService) {
|
||||
var service = {
|
||||
getRegions: getRegions,
|
||||
getHosts: getHosts,
|
||||
getRegion: getRegion
|
||||
};
|
||||
|
||||
/**
|
||||
* @name getRegions
|
||||
* @description Gets a list of regions
|
||||
*
|
||||
* @returns {Object} an object with 'items'
|
||||
*/
|
||||
function getRegions() {
|
||||
return apiService.get('api/craton/regions')
|
||||
.error(function error() {
|
||||
toastService.add('error', gettext("Unable to get the Craton regions listing"));
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* @name getRegion
|
||||
* @param identifier Region Id
|
||||
* @returns {Object} api call result
|
||||
*/
|
||||
function getRegion(identifier) {
|
||||
return apiService.get('api/craton/regions/' + identifier + '/')
|
||||
.error(function error() {
|
||||
toastService.add('error', gettext("Unable to get the Craton Region"));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @name getHosts
|
||||
* @description Gets a list of hosts
|
||||
* @param params {Object} query filter params
|
||||
* @returns {Object} an object with 'items'
|
||||
*/
|
||||
function getHosts(params) {
|
||||
var config = params ? {'params': params} : {};
|
||||
return apiService.get('api/craton/hosts', config)
|
||||
.error(function error() {
|
||||
toastService.add('error', gettext('Unable to retrieve the hosts'));
|
||||
});
|
||||
}
|
||||
|
||||
return service;
|
||||
}
|
||||
|
||||
}());
|
|
@ -1,76 +0,0 @@
|
|||
/**
|
||||
* Copyright 2016 Intel Corporation
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
describe('Craton API', function() {
|
||||
var testCall, service;
|
||||
var apiService = {};
|
||||
var toastService = {};
|
||||
|
||||
beforeEach(
|
||||
module('horizon.mock.openstack-service-api',
|
||||
function($provide, initServices) {
|
||||
testCall = initServices($provide, apiService, toastService);
|
||||
})
|
||||
);
|
||||
|
||||
beforeEach(module('horizon.app.core.openstack-service-api'));
|
||||
|
||||
beforeEach(inject(['horizon.app.core.openstack-service-api.craton', function(cratonAPI) {
|
||||
service = cratonAPI;
|
||||
}]));
|
||||
|
||||
it('defines the service', function() {
|
||||
expect(service).toBeDefined();
|
||||
});
|
||||
|
||||
var tests = [
|
||||
{
|
||||
func: "getRegions",
|
||||
method: "get",
|
||||
path: "api/craton/regions",
|
||||
error: "Unable to get the Craton regions listing"
|
||||
},
|
||||
{
|
||||
func: "getRegion",
|
||||
method: "get",
|
||||
path: "api/craton/regions/spam/",
|
||||
error: "Unable to get the Craton Region",
|
||||
testInput: ["spam"]
|
||||
},
|
||||
{
|
||||
func: "getHosts",
|
||||
method: "get",
|
||||
path: "api/craton/hosts",
|
||||
error: "Unable to retrieve the hosts",
|
||||
data: {}
|
||||
}
|
||||
];
|
||||
|
||||
// Iterate through the defined tests and apply as Jasmine specs.
|
||||
angular.forEach(tests, function(params) {
|
||||
it('defines the ' + params.func + ' call properly', function test() {
|
||||
var callParams = [apiService, service, toastService, params];
|
||||
testCall.apply(this, callParams);
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
})();
|
|
@ -1,26 +0,0 @@
|
|||
/**
|
||||
* Copyright 2016 Intel Corporation
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
describe('horizon.dashboard.project.fleet_management', function() {
|
||||
it('should be defined',function test() {
|
||||
expect(angular.module('horizon.dashboard.project.fleet_management')).toBeDefined();
|
||||
});
|
||||
});
|
||||
|
||||
})();
|
|
@ -1,70 +0,0 @@
|
|||
/**
|
||||
* Copyright 2016 Intel Corporation
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @ngdoc overview
|
||||
* @name horizon.dashboard.project.fleet_management
|
||||
*
|
||||
* @description
|
||||
* Dashboard module to host various backup panels.
|
||||
*/
|
||||
angular
|
||||
.module('horizon.dashboard.project.fleet_management', [
|
||||
'horizon.dashboard.project.fleet_management.regions'
|
||||
])
|
||||
.config(config);
|
||||
|
||||
config.$inject = [
|
||||
'$provide',
|
||||
'$windowProvider'
|
||||
];
|
||||
|
||||
function config($provide, $windowProvider) {
|
||||
var basePath = $windowProvider.$get().STATIC_URL + 'dashboard/project/fleet_management/';
|
||||
$provide.constant('horizon.dashboard.project.fleet_management.basePath', basePath);
|
||||
|
||||
// var regions = '/project/regions';
|
||||
// var taskflows = '/project/fleet/taskflows';
|
||||
// var alerts = '/project/fleet/alerts';
|
||||
// var auditor = '/project/fleet/auditor';
|
||||
// var reporting = '/project/fleet/reporting';
|
||||
// var inventory = '/project/fleet/inventory';
|
||||
//
|
||||
// $routeProvider
|
||||
// .when(regions, {
|
||||
// templateUrl: basePath + 'regions/index.html'
|
||||
// })
|
||||
// .when(taskflows, {
|
||||
// templateUrl: basePath + 'taskflows/index.html'
|
||||
// })
|
||||
// .when(alerts, {
|
||||
// templateUrl: basePath + 'alerts/index.html'
|
||||
// })
|
||||
// .when(auditor, {
|
||||
// templateUrl: basePath + 'auditor/index.html'
|
||||
// })
|
||||
// .when(reporting, {
|
||||
// templateUrl: basePath + 'reporting/index.html'
|
||||
// })
|
||||
// .when(inventory, {
|
||||
// templateUrl: basePath + 'inventory/index.html'
|
||||
// });
|
||||
}
|
||||
|
||||
})();
|
|
@ -1,10 +0,0 @@
|
|||
<div class="row" ng-controller="horizon.dashboard.project.fleet_management.regions.RegionDrawerController as ctrl">
|
||||
<div class="col-sm-12">
|
||||
<div class="col-sm-1" ng-if="ctrl.region.hosts.length > 0" ng-repeat="host in ctrl.region.hosts track by host.id">
|
||||
<a href="#" class="btn btn-sm btn-default">{$ host.name $}</a>
|
||||
</div>
|
||||
<p ng-if="ctrl.region.hosts.length == 0">
|
||||
<translate>No items to display.</translate>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
|
@ -1,47 +0,0 @@
|
|||
/**
|
||||
* Copyright 2016 Intel Corporation
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
angular.module('horizon.dashboard.project.fleet_management.regions')
|
||||
.controller('horizon.dashboard.project.fleet_management.regions.RegionDrawerController',
|
||||
RegionDrawerController);
|
||||
|
||||
RegionDrawerController.$inject = [
|
||||
'horizon.dashboard.project.fleet_management.regions.resourceType',
|
||||
'horizon.framework.conf.resource-type-registry.service',
|
||||
'horizon.app.core.openstack-service-api.craton',
|
||||
'$scope'
|
||||
];
|
||||
|
||||
function RegionDrawerController(regionResourceType, registry, cratonApi, $scope) {
|
||||
var ctrl = this;
|
||||
|
||||
ctrl.region = $scope.item || {};
|
||||
ctrl.region.hosts = [];
|
||||
ctrl.resourceType = registry.getResourceType(regionResourceType);
|
||||
|
||||
getHosts();
|
||||
|
||||
function getHosts() {
|
||||
cratonApi.getHosts({region_id: ctrl.region.id }).then(function resolve(data) {
|
||||
ctrl.region.hosts = data.data.items;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
})();
|
|
@ -1,50 +0,0 @@
|
|||
/**
|
||||
* Copyright 2016 Intel Corporation
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
describe('horizon.dashboard.project.fleet_management.regions RegionsDrawerController',
|
||||
function () {
|
||||
beforeEach(module('horizon.app.core.openstack-service-api'));
|
||||
beforeEach(module('horizon.framework'));
|
||||
beforeEach(module('horizon.dashboard.project'));
|
||||
beforeEach(module('horizon.dashboard.project.fleet_management'));
|
||||
|
||||
var /*$q, $rootScope,*/ scope, cratonAPI, controller;
|
||||
|
||||
beforeEach(inject( function ($injector, _$q_, _$rootScope_) {
|
||||
controller = $injector.get('$controller');
|
||||
// $q = _$q_;
|
||||
// $rootScope = _$rootScope_;
|
||||
scope = _$rootScope_.$new();
|
||||
cratonAPI = $injector.get('horizon.app.core.openstack-service-api.craton');
|
||||
}));
|
||||
|
||||
function createController() {
|
||||
return controller(
|
||||
'horizon.dashboard.project.fleet_management.regions.RegionDrawerController',
|
||||
{$scope: scope});
|
||||
}
|
||||
|
||||
it('should call api getHosts when created', function test() {
|
||||
spyOn(cratonAPI, 'getHosts').and.callThrough();
|
||||
createController();
|
||||
expect(cratonAPI.getHosts).toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
|
||||
})();
|
|
@ -1,4 +0,0 @@
|
|||
<hz-page-header header="{$ 'Inventory' | translate $}"></hz-page-header>
|
||||
<div>
|
||||
|
||||
</div>
|
|
@ -1,5 +0,0 @@
|
|||
<hz-resource-panel resource-type-name="OS::Craton::Region">
|
||||
<hz-resource-table resource-type-name="OS::Craton::Region"
|
||||
track-by="id">
|
||||
</hz-resource-table>
|
||||
</hz-resource-panel>
|
|
@ -1,91 +0,0 @@
|
|||
/**
|
||||
* Copyright 2016 Intel Corporation
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @ngdoc Craton Regions module for fleet managament
|
||||
*
|
||||
* @name horizon.dashboard.project.fleet_management.regions
|
||||
*
|
||||
* @description
|
||||
* Provides services and widgets required to support and display
|
||||
* fleet management regions content
|
||||
*/
|
||||
|
||||
angular
|
||||
.module('horizon.dashboard.project.fleet_management.regions', ['ngRoute'])
|
||||
.constant('horizon.dashboard.project.fleet_management.regions.resourceType',
|
||||
'OS::Craton::Region')
|
||||
.run(run)
|
||||
.config(config);
|
||||
|
||||
run.$inject = [
|
||||
'horizon.framework.conf.resource-type-registry.service',
|
||||
'horizon.app.core.openstack-service-api.craton',
|
||||
'horizon.dashboard.project.fleet_management.basePath',
|
||||
'horizon.dashboard.project.fleet_management.regions.resourceType'
|
||||
];
|
||||
|
||||
function run(registry, craton, basePath, cratonResourceType) {
|
||||
registry.getResourceType(cratonResourceType)
|
||||
.setNames(gettext('Region'), gettext('Regions'))
|
||||
.setSummaryTemplateUrl(basePath + 'inventory/details/drawer.html')
|
||||
.setProperty('name', {label: gettext('Name')})
|
||||
.setProperty('id', {label: gettext('ID')})
|
||||
.setProperty('note', {label: gettext('Note')})
|
||||
.setProperty('project_id', {label:gettext('Project ID')})
|
||||
.setListFunction(listFunction)
|
||||
.tableColumns
|
||||
.append({
|
||||
id: 'name',
|
||||
priority: 1,
|
||||
sortDefault: true
|
||||
})
|
||||
.append({
|
||||
id: 'id',
|
||||
priority: 1
|
||||
})
|
||||
.append({
|
||||
id: 'note',
|
||||
priority: 2
|
||||
})
|
||||
.append({
|
||||
id: 'project_id',
|
||||
priority: 3
|
||||
});
|
||||
|
||||
function listFunction() {
|
||||
return craton.getRegions();
|
||||
}
|
||||
}
|
||||
|
||||
config.$inject = [
|
||||
'$provide',
|
||||
'$windowProvider',
|
||||
'$routeProvider'
|
||||
];
|
||||
|
||||
function config($provide, $windowProvider, $routeProvider) {
|
||||
var path = $windowProvider.$get().STATIC_URL + 'dashboard/project/fleet_management/inventory/';
|
||||
$provide.constant('horizon.dashboard.project.fleet_management.regions.basePath', path);
|
||||
|
||||
$routeProvider.when('/fleet_management/', {
|
||||
templateUrl: path + 'panel.html'
|
||||
});
|
||||
}
|
||||
})();
|
|
@ -1,26 +0,0 @@
|
|||
/**
|
||||
* Copyright 2016 Intel Corporation
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
describe('horizon.dashboard.project.fleet_management.regions', function () {
|
||||
it('should be defined', function test() {
|
||||
expect(angular.module('horizon.dashboard.project.fleet_management.regions')).toBeDefined();
|
||||
});
|
||||
});
|
||||
|
||||
})();
|
|
@ -1,4 +0,0 @@
|
|||
<hz-page-header header="{$ 'Taskflows' | translate $}"></hz-page-header>p
|
||||
|
||||
<div>
|
||||
</div>
|
|
@ -1,22 +0,0 @@
|
|||
/**
|
||||
* Copyright 2016 Intel Corporation
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
// TODO: ADD TESTS!!
|
||||
|
||||
})();
|
|
@ -1,31 +0,0 @@
|
|||
# Copyright 2016 Intel Corporation
|
||||
#
|
||||
# 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 craton_dashboard import api
|
||||
from craton_dashboard.test import helpers as test
|
||||
|
||||
|
||||
class CratonApiTests(test.CratonAPITestCase):
|
||||
|
||||
def test_regions_list(self):
|
||||
regions = self.craton_regions.list()
|
||||
cratonclient = self.stub_cratonclient()
|
||||
cratonclient.regions = self.mox.CreateMockAnything()
|
||||
cratonclient.regions.list(project_id=regions[0].project_id)\
|
||||
.AndReturn(regions)
|
||||
self.mox.ReplayAll()
|
||||
result = api.craton.region_list(self.request,
|
||||
project_id=regions[0].project_id)
|
||||
|
||||
self.assertEqual(len(regions), len(result))
|
|
@ -1,63 +0,0 @@
|
|||
# Copyright 2016 Intel Corporation
|
||||
#
|
||||
# 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 mock
|
||||
|
||||
from cratonclient.v1 import client as craton_client
|
||||
|
||||
from openstack_dashboard.test import helpers
|
||||
|
||||
from craton_dashboard import api
|
||||
from craton_dashboard.test.test_data import utils
|
||||
|
||||
|
||||
def create_stubs(stubs_to_create={}):
|
||||
return helpers.create_stubs(stubs_to_create)
|
||||
|
||||
|
||||
class CratonTestsMixin(object):
|
||||
def _setup_test_data(self):
|
||||
super(CratonTestsMixin, self)._setup_test_data()
|
||||
utils.load_test_data(self)
|
||||
self.policy_patcher = mock.patch(
|
||||
'openstack_auth.policy.check', lambda action, request: True)
|
||||
self._policy_check = self.policy_patcher.start()
|
||||
|
||||
|
||||
class TestCase(CratonTestsMixin, helpers.TestCase):
|
||||
pass
|
||||
|
||||
|
||||
class BaseAdminViewTests(CratonTestsMixin, helpers.TestCase):
|
||||
pass
|
||||
|
||||
|
||||
class CratonAPITestCase(CratonTestsMixin, helpers.APITestCase):
|
||||
def setUp(self):
|
||||
super(CratonAPITestCase, self).setUp()
|
||||
|
||||
self._original_craton_client = api.craton.cratonclient
|
||||
api.craton.cratonclient = lambda request: self.stub_cratonclient()
|
||||
|
||||
def tearDown(self):
|
||||
super(CratonAPITestCase, self).tearDown()
|
||||
|
||||
api.craton.cratonclient = self._original_craton_client
|
||||
|
||||
def stub_cratonclient(self):
|
||||
if not hasattr(self, "cratonclient"):
|
||||
self.mox.StubOutWithMock(craton_client, 'Client')
|
||||
self.cratonclient = self.mox.CreateMock(craton_client.Client)
|
||||
return self.cratonclient
|
|
@ -1,17 +0,0 @@
|
|||
# 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 horizon.test.settings import * # noqa
|
||||
from openstack_dashboard.test.settings import * # noqa
|
||||
|
||||
INSTALLED_APPS = list(INSTALLED_APPS)
|
||||
INSTALLED_APPS.append('craton_dashboard.content.fleet_management')
|
|
@ -1,49 +0,0 @@
|
|||
# Copyright 2016 Intel Corporation
|
||||
#
|
||||
# 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 cratonclient import session
|
||||
from cratonclient.v1 import regions
|
||||
|
||||
from openstack_dashboard.test.test_data import utils
|
||||
|
||||
|
||||
def data(TEST):
|
||||
URL = 'http://localhost/'
|
||||
TEST.craton_regions = utils.TestDataContainer()
|
||||
SESSION = session.Session(username="test",
|
||||
token="testPassword",
|
||||
project_id='1')
|
||||
# Regions
|
||||
|
||||
region_1 = regions.Region(regions.RegionManager(SESSION, URL), {
|
||||
'id': 1,
|
||||
'name': 'Region1',
|
||||
'note': 'TestNote',
|
||||
'project_id': 1
|
||||
})
|
||||
region_2 = regions.Region(regions.RegionManager(SESSION, URL), {
|
||||
'id': 2,
|
||||
'name': 'Region2',
|
||||
'note': 'TestNote',
|
||||
'project_id': 1
|
||||
})
|
||||
region_3 = regions.Region(regions.RegionManager(SESSION, URL), {
|
||||
'id': 3,
|
||||
'name': 'Region3',
|
||||
'note': 'TestNote',
|
||||
'project_id': 1
|
||||
})
|
||||
TEST.craton_regions.add(region_1)
|
||||
TEST.craton_regions.add(region_2)
|
||||
TEST.craton_regions.add(region_3)
|
|
@ -1,28 +0,0 @@
|
|||
# Copyright 2016 Intel Corporation
|
||||
#
|
||||
# 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.
|
||||
|
||||
|
||||
def data(TEST):
|
||||
|
||||
# Add craton to the keystone data
|
||||
TEST.service_catalog.append(
|
||||
{"type": "fleetmanagement",
|
||||
"name": "craton",
|
||||
"endpoints_links": [],
|
||||
"endpoints": [
|
||||
{"region": "RegionOne",
|
||||
"adminURL": "http://admin.craton.example.com:8080/v1.1",
|
||||
"publicURL": "http://public.craton.example.com:8080/v1.1",
|
||||
"internalURL": "http://int.craton.example.com:8080/v1.1"}]}
|
||||
)
|
|
@ -1,53 +0,0 @@
|
|||
# Copyright 2016 Intel Corporation
|
||||
#
|
||||
# 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 openstack_dashboard.test.test_data import utils
|
||||
|
||||
|
||||
def load_test_data(load_onto=None):
|
||||
|
||||
from craton_dashboard.test.test_data import craton_data
|
||||
from craton_dashboard.test.test_data import keystone_data \
|
||||
as craton_keystone_data
|
||||
|
||||
from openstack_dashboard.test.test_data import ceilometer_data
|
||||
from openstack_dashboard.test.test_data import cinder_data
|
||||
from openstack_dashboard.test.test_data import exceptions
|
||||
from openstack_dashboard.test.test_data import glance_data
|
||||
from openstack_dashboard.test.test_data import heat_data
|
||||
from openstack_dashboard.test.test_data import keystone_data
|
||||
from openstack_dashboard.test.test_data import neutron_data
|
||||
from openstack_dashboard.test.test_data import nova_data
|
||||
from openstack_dashboard.test.test_data import swift_data
|
||||
|
||||
# The order of these loaders matters, some depend on others.
|
||||
loaders = (
|
||||
exceptions.data,
|
||||
keystone_data.data,
|
||||
glance_data.data,
|
||||
nova_data.data,
|
||||
cinder_data.data,
|
||||
neutron_data.data,
|
||||
swift_data.data,
|
||||
heat_data.data,
|
||||
ceilometer_data.data,
|
||||
craton_data.data,
|
||||
craton_keystone_data.data,
|
||||
)
|
||||
if load_onto:
|
||||
for data_func in loaders:
|
||||
data_func(load_onto)
|
||||
return load_onto
|
||||
else:
|
||||
return utils.TestData(*loaders)
|
|
@ -1,19 +0,0 @@
|
|||
# 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 import urls
|
||||
import openstack_dashboard.urls
|
||||
|
||||
urlpatterns = [
|
||||
urls.url(r'', urls.include(openstack_dashboard.urls))
|
||||
]
|
|
@ -1,80 +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('../..'))
|
||||
on_read_the_docs = os.environ.get('READTHEDOCS') == 'True'
|
||||
|
||||
|
||||
# -- 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',
|
||||
]
|
||||
|
||||
if not on_read_the_docs:
|
||||
extensions.append('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 = 'readme'
|
||||
|
||||
# General information about the project.
|
||||
project = u'craton-dashboard'
|
||||
copyright = u'2016, 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 +0,0 @@
|
|||
.. include:: ../../README.rst
|
195
karma.conf.js
195
karma.conf.js
|
@ -1,195 +0,0 @@
|
|||
/**
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
|
||||
'use-strict';
|
||||
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
|
||||
module.exports = function(config) {
|
||||
var xstaticPath;
|
||||
var horizonPath;
|
||||
var openstackDashboardPath;
|
||||
var horizonRoot;
|
||||
var basePaths = [
|
||||
'./.venv',
|
||||
'./.tox/py27'
|
||||
];
|
||||
|
||||
for (var i = 0; i < basePaths.length; i++) {
|
||||
var basePath = path.resolve(basePaths[i]);
|
||||
|
||||
if (fs.existsSync(basePath)) {
|
||||
xstaticPath = basePath + '/lib/python2.7/site-packages/xstatic/pkg/';
|
||||
horizonRoot = basePath + '/src/horizon/';
|
||||
horizonPath = basePath + '/src/horizon/horizon/';
|
||||
openstackDashboardPath = basePath + '/src/horizon/openstack_dashboard/';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!xstaticPath) {
|
||||
console.error('xStatic libraries not found, please set up venv');
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
config.set({
|
||||
preprocessors: {
|
||||
// Used to collect templates for preprocessing.
|
||||
// NOTE: the templates must also be listed in the files section below.
|
||||
'./**/*.html': ['ng-html2js'],
|
||||
// Used to indicate files requiring coverage reports.
|
||||
'./craton_dashboard/static/**/!(*.spec).js': ['coverage']
|
||||
},
|
||||
|
||||
// Sets up module to process templates.
|
||||
ngHtml2JsPreprocessor: {
|
||||
moduleName: 'templates',
|
||||
cacheIdFromPath: function(filepath) {
|
||||
// This function takes the raw provided path from the file searches
|
||||
// below (in the files: pattern list), applies the filter from the
|
||||
// preprocessor above (basically, finds the html files), then uses
|
||||
// this function to translate the relative file path into a path
|
||||
// that matches what would actually be called in production.
|
||||
//
|
||||
// e.g.
|
||||
// dashboards/project/static/dashboard/project/workflow/launch-instance/configuration/load-edit.html
|
||||
// becomes:
|
||||
// /static/dashboard/project/workflow/launch-instance/configuration/load-edit.html
|
||||
// We can't just use stripPrefix because there are a couple of
|
||||
// prefixes that need to be altered (and may be more).
|
||||
return filepath.replace(/^dashboards\/[^\/]+/, '')
|
||||
.replace(/^static\/app/, '/static/app');
|
||||
},
|
||||
},
|
||||
|
||||
// This establishes the base for most referenced paths as being relative
|
||||
// to this file, i.e. ./craton_dashboard.
|
||||
basePath: '.',
|
||||
|
||||
// Contains both source and test files.
|
||||
files: [
|
||||
|
||||
// from jasmine.html
|
||||
xstaticPath + 'jquery/data/jquery.js',
|
||||
xstaticPath + 'angular/data/angular.js',
|
||||
xstaticPath + 'angular/data/angular-route.js',
|
||||
xstaticPath + 'angular/data/angular-mocks.js',
|
||||
xstaticPath + 'angular/data/angular-cookies.js',
|
||||
xstaticPath + 'angular_bootstrap/data/angular-bootstrap.js',
|
||||
xstaticPath + 'angular_gettext/data/angular-gettext.js',
|
||||
xstaticPath + 'angular_fileupload/data/ng-file-upload-all.js',
|
||||
xstaticPath + 'angular/data/angular-sanitize.js',
|
||||
xstaticPath + 'd3/data/d3.js',
|
||||
xstaticPath + 'rickshaw/data/rickshaw.js',
|
||||
xstaticPath + 'angular_smart_table/data/smart-table.js',
|
||||
xstaticPath + 'angular_lrdragndrop/data/lrdragndrop.js',
|
||||
xstaticPath + 'spin/data/spin.js',
|
||||
xstaticPath + 'spin/data/spin.jquery.js',
|
||||
xstaticPath + 'tv4/data/tv4.js',
|
||||
xstaticPath + 'objectpath/data/ObjectPath.js',
|
||||
xstaticPath + 'angular_schema_form/data/schema-form.js',
|
||||
|
||||
/**
|
||||
* Include framework source code from horizon and openstack_dashboard
|
||||
* that we need.
|
||||
* Otherwise, karma will not be able to find them when testing.
|
||||
* These files should be mocked in the foreseeable future.
|
||||
* These are located within the project's ./.venv/horizon directory.
|
||||
*/
|
||||
|
||||
// Getting horizon's test-shim.js for gettext modules and others
|
||||
horizonRoot + 'test-shim.js',
|
||||
|
||||
horizonPath + 'static/horizon/js/horizon.js',
|
||||
horizonPath + 'static/framework/**/*.module.js',
|
||||
horizonPath + 'static/framework/**/!(*.spec|*.mock).js',
|
||||
openstackDashboardPath + 'static/app/**/*.module.js',
|
||||
openstackDashboardPath + 'static/app/**/!(*.spec|*.mock).js',
|
||||
openstackDashboardPath + 'static/app/**/*.mock.js',
|
||||
openstackDashboardPath + 'dashboards/**/static/**/**/*.module.js',
|
||||
|
||||
/**
|
||||
* First, list all the files that defines application's angular modules.
|
||||
* Those files have extension of `.module.js`. The order among them is
|
||||
* not significant.
|
||||
*/
|
||||
'./craton_dashboard/static/app/core/**/*.module.js',
|
||||
'./craton_dashboard/static/dashboard/**/**/**/*.module.js',
|
||||
|
||||
/**
|
||||
* Followed by other JavaScript files that defines angular providers
|
||||
* on the modules defined in files listed above. And they are not mock
|
||||
* files or spec files defined below. The order among them is not
|
||||
* significant.
|
||||
*/
|
||||
'./craton_dashboard/static/app/core/**/!(*.spec|*.mock).js',
|
||||
'./craton_dashboard/static/dashboard/**/**/**/!(*.spec|*.mock).js',
|
||||
|
||||
/**
|
||||
* Then, list files for mocks with `mock.js` extension. The order
|
||||
* among them should not be significant.
|
||||
*/
|
||||
'./craton_dashboard/static/app/core/**/*.mock.js',
|
||||
'./craton_dashboard/static/dashboard/**/**/**/*.mock.js',
|
||||
|
||||
/**
|
||||
* Finally, list files for spec with `spec.js` extension. The order
|
||||
* among them should not be significant.
|
||||
*/
|
||||
'./craton_dashboard/static/app/core/**/*.spec.js',
|
||||
'./craton_dashboard/static/dashboard/**/**/**/*.spec.js',
|
||||
|
||||
/**
|
||||
* Angular external templates
|
||||
*/
|
||||
'./craton_dashboard/static/app/core/**/*.html',
|
||||
'./craton_dashboard/static/dashboard/**/**/**/*.html'
|
||||
],
|
||||
|
||||
autoWatch: true,
|
||||
|
||||
frameworks: ['jasmine'],
|
||||
|
||||
browsers: ['Chrome'],
|
||||
|
||||
browserNoActivityTimeout: 60000,
|
||||
|
||||
reporters: ['progress', 'coverage', 'threshold'],
|
||||
|
||||
plugins: [
|
||||
'karma-chrome-launcher',
|
||||
'karma-jasmine',
|
||||
'karma-ng-html2js-preprocessor',
|
||||
'karma-coverage',
|
||||
'karma-threshold-reporter'
|
||||
],
|
||||
|
||||
// Places coverage report in HTML format in the subdirectory below.
|
||||
coverageReporter: {
|
||||
type: 'html',
|
||||
dir: '../cover/craton_dashboard'
|
||||
},
|
||||
|
||||
// Coverage threshold values.
|
||||
thresholdReporter: {
|
||||
statements: 1, // target 100
|
||||
branches: 1, // target 100
|
||||
functions: 1, // target 100
|
||||
lines: 1 // target 100
|
||||
}
|
||||
});
|
||||
};
|
23
manage.py
23
manage.py
|
@ -1,23 +0,0 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
# 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
|
||||
|
||||
from django.core.management import execute_from_command_line
|
||||
|
||||
if __name__ == "__main__":
|
||||
os.environ.setdefault("DJANGO_SETTINGS_MODULE",
|
||||
"craton_dashboard.test.settings")
|
||||
execute_from_command_line(sys.argv)
|
30
package.json
30
package.json
|
@ -1,30 +0,0 @@
|
|||
{
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"name": "craton-dashboard",
|
||||
"description": "OpenStack Craton Dashboard - Angular",
|
||||
"repository": "none",
|
||||
"license": "Apache 2.0",
|
||||
"devDependencies": {
|
||||
"eslint": "1.10.3",
|
||||
"eslint-config-openstack": "1.2.4",
|
||||
"eslint-plugin-angular": "1.0.1",
|
||||
"jasmine-core": "2.4.1",
|
||||
"karma": "1.1.2",
|
||||
"karma-chrome-launcher": "1.0.1",
|
||||
"karma-cli": "1.0.1",
|
||||
"karma-coverage": "1.1.1",
|
||||
"karma-jasmine": "1.0.2",
|
||||
"karma-ng-html2js-preprocessor": "1.0.0",
|
||||
"karma-threshold-reporter": "0.1.15"
|
||||
},
|
||||
"scripts": {
|
||||
"postinstall": "if [ ! -d .venv ]; then tox -epy27 --notest; fi",
|
||||
"test": "karma start ./karma.conf.js --single-run",
|
||||
"lint": "eslint --no-color craton_dashboard/static",
|
||||
"lintq": "eslint --quiet craton_dashboard/static"
|
||||
},
|
||||
"dependencies": {
|
||||
"angular": "1.5.8"
|
||||
}
|
||||
}
|
|
@ -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.
|
||||
|
||||
pbr>=1.6 # Apache-2.0
|
||||
# Horizon Core Requirements
|
||||
Babel>=2.3.4 # BSD
|
||||
Django<1.9,>=1.8 # BSD
|
||||
django-compressor>=2.0 # MIT
|
||||
django-openstack-auth>=2.3.0 # Apache-2.0
|
||||
iso8601>=0.1.11 # MIT
|
||||
python-keystoneclient!=1.8.0,!=2.1.0,>=1.7.0 # Apache-2.0
|
||||
python-neutronclient>=4.2.0 # Apache-2.0
|
||||
python-novaclient!=2.33.0,>=2.29.0 # Apache-2.0
|
||||
pytz>=2013.6 # MIT
|
||||
-e git+http://git.openstack.org/openstack/python-cratonclient#egg=python-cratonclient
|
553
run_tests.sh
553
run_tests.sh
|
@ -1,553 +0,0 @@
|
|||
#!/bin/bash
|
||||
|
||||
set -o errexit
|
||||
|
||||
function usage {
|
||||
echo "Usage: $0 [OPTION]..."
|
||||
echo "Run Horizon's test suite(s)"
|
||||
echo ""
|
||||
echo " -V, --virtual-env Always use virtualenv. Install automatically"
|
||||
echo " if not present"
|
||||
echo " -N, --no-virtual-env Don't use virtualenv. Run tests in local"
|
||||
echo " environment"
|
||||
echo " -c, --coverage Generate reports using Coverage"
|
||||
echo " -f, --force Force a clean re-build of the virtual"
|
||||
echo " environment. Useful when dependencies have"
|
||||
echo " been added."
|
||||
echo " -m, --manage Run a Django management command."
|
||||
echo " --makemessages Create/Update English translation files."
|
||||
echo " --compilemessages Compile all translation files."
|
||||
echo " --check-only Do not update translation files (--makemessages only)."
|
||||
echo " --pseudo Pseudo translate a language."
|
||||
echo " -p, --pep8 Just run pep8"
|
||||
echo " -8, --pep8-changed [<basecommit>]"
|
||||
echo " Just run PEP8 and HACKING compliance check"
|
||||
echo " on files changed since HEAD~1 (or <basecommit>)"
|
||||
echo " -P, --no-pep8 Don't run pep8 by default"
|
||||
echo " -t, --tabs Check for tab characters in files."
|
||||
echo " -y, --pylint Just run pylint"
|
||||
echo " -q, --quiet Run non-interactively. (Relatively) quiet."
|
||||
echo " Implies -V if -N is not set."
|
||||
echo " --only-selenium Run only the Selenium unit tests"
|
||||
echo " --with-selenium Run unit tests including Selenium tests"
|
||||
echo " --selenium-headless Run Selenium tests headless"
|
||||
echo " --integration Run the integration tests (requires a running "
|
||||
echo " OpenStack environment)"
|
||||
echo " --runserver Run the Django development server for"
|
||||
echo " openstack_dashboard in the virtual"
|
||||
echo " environment."
|
||||
echo " --docs Just build the documentation"
|
||||
echo " --backup-environment Make a backup of the environment on exit"
|
||||
echo " --restore-environment Restore the environment before running"
|
||||
echo " --destroy-environment Destroy the environment and exit"
|
||||
echo " -h, --help Print this usage message"
|
||||
echo ""
|
||||
echo "Note: with no options specified, the script will try to run the tests in"
|
||||
echo " a virtual environment, If no virtualenv is found, the script will ask"
|
||||
echo " if you would like to create one. If you prefer to run tests NOT in a"
|
||||
echo " virtual environment, simply pass the -N option."
|
||||
exit
|
||||
}
|
||||
|
||||
# DEFAULTS FOR RUN_TESTS.SH
|
||||
#
|
||||
root=`pwd -P`
|
||||
venv=$root/.venv
|
||||
venv_env_version=$venv/environments
|
||||
with_venv=tools/with_venv.sh
|
||||
included_dirs="craton_dashboard"
|
||||
|
||||
always_venv=0
|
||||
backup_env=0
|
||||
command_wrapper=""
|
||||
destroy=0
|
||||
force=0
|
||||
just_pep8=0
|
||||
just_pep8_changed=0
|
||||
no_pep8=0
|
||||
just_pylint=0
|
||||
just_docs=0
|
||||
just_tabs=0
|
||||
never_venv=0
|
||||
quiet=0
|
||||
restore_env=0
|
||||
runserver=0
|
||||
only_selenium=0
|
||||
with_selenium=0
|
||||
selenium_headless=0
|
||||
integration=0
|
||||
testopts=""
|
||||
testargs=""
|
||||
with_coverage=0
|
||||
makemessages=0
|
||||
compilemessages=0
|
||||
check_only=0
|
||||
pseudo=0
|
||||
manage=0
|
||||
|
||||
# Jenkins sets a "JOB_NAME" variable, if it's not set, we'll make it "default"
|
||||
[ "$JOB_NAME" ] || JOB_NAME="default"
|
||||
|
||||
function process_option {
|
||||
# If running manage command, treat the rest of options as arguments.
|
||||
if [ $manage -eq 1 ]; then
|
||||
testargs="$testargs $1"
|
||||
return 0
|
||||
fi
|
||||
|
||||
case "$1" in
|
||||
-h|--help) usage;;
|
||||
-V|--virtual-env) always_venv=1; never_venv=0;;
|
||||
-N|--no-virtual-env) always_venv=0; never_venv=1;;
|
||||
-p|--pep8) just_pep8=1;;
|
||||
-8|--pep8-changed) just_pep8_changed=1;;
|
||||
-P|--no-pep8) no_pep8=1;;
|
||||
-y|--pylint) just_pylint=1;;
|
||||
-f|--force) force=1;;
|
||||
-t|--tabs) just_tabs=1;;
|
||||
-q|--quiet) quiet=1;;
|
||||
-c|--coverage) with_coverage=1;;
|
||||
-m|--manage) manage=1;;
|
||||
--makemessages) makemessages=1;;
|
||||
--compilemessages) compilemessages=1;;
|
||||
--check-only) check_only=1;;
|
||||
--pseudo) pseudo=1;;
|
||||
--only-selenium) only_selenium=1;;
|
||||
--with-selenium) with_selenium=1;;
|
||||
--selenium-headless) selenium_headless=1;;
|
||||
--integration) integration=1;;
|
||||
--docs) just_docs=1;;
|
||||
--runserver) runserver=1;;
|
||||
--backup-environment) backup_env=1;;
|
||||
--restore-environment) restore_env=1;;
|
||||
--destroy-environment) destroy=1;;
|
||||
-*) testopts="$testopts $1";;
|
||||
*) testargs="$testargs $1"
|
||||
esac
|
||||
}
|
||||
|
||||
function run_management_command {
|
||||
${command_wrapper} python $root/manage.py $testopts $testargs
|
||||
}
|
||||
|
||||
function run_server {
|
||||
echo "Starting Django development server..."
|
||||
${command_wrapper} python $root/manage.py runserver $testopts $testargs
|
||||
echo "Server stopped."
|
||||
}
|
||||
|
||||
function run_pylint {
|
||||
echo "Running pylint ..."
|
||||
PYTHONPATH=$root ${command_wrapper} pylint --rcfile=.pylintrc -f parseable $included_dirs > pylint.txt || true
|
||||
CODE=$?
|
||||
grep Global -A2 pylint.txt
|
||||
if [ $CODE -lt 32 ]; then
|
||||
echo "Completed successfully."
|
||||
exit 0
|
||||
else
|
||||
echo "Completed with problems."
|
||||
exit $CODE
|
||||
fi
|
||||
}
|
||||
|
||||
function warn_on_flake8_without_venv {
|
||||
set +o errexit
|
||||
${command_wrapper} python -c "import hacking" 2>/dev/null
|
||||
no_hacking=$?
|
||||
set -o errexit
|
||||
if [ $never_venv -eq 1 -a $no_hacking -eq 1 ]; then
|
||||
echo "**WARNING**:" >&2
|
||||
echo "OpenStack hacking is not installed on your host. Its detection will be missed." >&2
|
||||
echo "Please install or use virtual env if you need OpenStack hacking detection." >&2
|
||||
fi
|
||||
}
|
||||
|
||||
function run_pep8 {
|
||||
echo "Running flake8 ..."
|
||||
warn_on_flake8_without_venv
|
||||
DJANGO_SETTINGS_MODULE=craton_dashboard.test.settings ${command_wrapper} flake8
|
||||
}
|
||||
|
||||
function run_pep8_changed {
|
||||
# NOTE(gilliard) We want use flake8 to check the entirety of every file that has
|
||||
# a change in it. Unfortunately the --filenames argument to flake8 only accepts
|
||||
# file *names* and there are no files named (eg) "nova/compute/manager.py". The
|
||||
# --diff argument behaves surprisingly as well, because although you feed it a
|
||||
# diff, it actually checks the file on disk anyway.
|
||||
local base_commit=${testargs:-HEAD~1}
|
||||
files=$(git diff --name-only $base_commit | tr '\n' ' ')
|
||||
echo "Running flake8 on ${files}"
|
||||
warn_on_flake8_without_venv
|
||||
diff -u --from-file /dev/null ${files} | DJANGO_SETTINGS_MODULE=craton_dashboard.test.settings ${command_wrapper} flake8 --diff
|
||||
exit
|
||||
}
|
||||
|
||||
function run_sphinx {
|
||||
echo "Building sphinx..."
|
||||
DJANGO_SETTINGS_MODULE=craton_dashboard.test.settings ${command_wrapper} python setup.py build_sphinx
|
||||
echo "Build complete."
|
||||
}
|
||||
|
||||
function tab_check {
|
||||
TAB_VIOLATIONS=`find $included_dirs -type f -regex ".*\.\(css\|js\|py\|html\)" -print0 | xargs -0 awk '/\t/' | wc -l`
|
||||
if [ $TAB_VIOLATIONS -gt 0 ]; then
|
||||
echo "TABS! $TAB_VIOLATIONS of them! Oh no!"
|
||||
HORIZON_FILES=`find $included_dirs -type f -regex ".*\.\(css\|js\|py|\html\)"`
|
||||
for TABBED_FILE in $HORIZON_FILES
|
||||
do
|
||||
TAB_COUNT=`awk '/\t/' $TABBED_FILE | wc -l`
|
||||
if [ $TAB_COUNT -gt 0 ]; then
|
||||
echo "$TABBED_FILE: $TAB_COUNT"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
return $TAB_VIOLATIONS;
|
||||
}
|
||||
|
||||
function destroy_venv {
|
||||
echo "Cleaning environment..."
|
||||
echo "Removing virtualenv..."
|
||||
rm -rf $venv
|
||||
echo "Virtualenv removed."
|
||||
}
|
||||
|
||||
function environment_check {
|
||||
echo "Checking environment."
|
||||
if [ -f $venv_env_version ]; then
|
||||
set +o errexit
|
||||
cat requirements.txt test-requirements.txt | cmp $venv_env_version - > /dev/null
|
||||
local env_check_result=$?
|
||||
set -o errexit
|
||||
if [ $env_check_result -eq 0 ]; then
|
||||
# If the environment exists and is up-to-date then set our variables
|
||||
command_wrapper="${root}/${with_venv}"
|
||||
echo "Environment is up to date."
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ $always_venv -eq 1 ]; then
|
||||
install_venv
|
||||
else
|
||||
if [ ! -e ${venv} ]; then
|
||||
echo -e "Environment not found. Install? (Y/n) \c"
|
||||
else
|
||||
echo -e "Your environment appears to be out of date. Update? (Y/n) \c"
|
||||
fi
|
||||
read update_env
|
||||
if [ "x$update_env" = "xY" -o "x$update_env" = "x" -o "x$update_env" = "xy" ]; then
|
||||
install_venv
|
||||
else
|
||||
# Set our command wrapper anyway.
|
||||
command_wrapper="${root}/${with_venv}"
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function sanity_check {
|
||||
# Anything that should be determined prior to running the tests, server, etc.
|
||||
# Don't sanity-check anything environment-related in -N flag is set
|
||||
if [ $never_venv -eq 0 ]; then
|
||||
if [ ! -e ${venv} ]; then
|
||||
echo "Virtualenv not found at $venv. Did install_venv.py succeed?"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
# Remove .pyc files. This is sanity checking because they can linger
|
||||
# after old files are deleted.
|
||||
find . -name "*.pyc" -exec rm -rf {} \;
|
||||
}
|
||||
|
||||
function backup_environment {
|
||||
if [ $backup_env -eq 1 ]; then
|
||||
echo "Backing up environment \"$JOB_NAME\"..."
|
||||
if [ ! -e ${venv} ]; then
|
||||
echo "Environment not installed. Cannot back up."
|
||||
return 0
|
||||
fi
|
||||
if [ -d /tmp/.horizon_environment/$JOB_NAME ]; then
|
||||
mv /tmp/.horizon_environment/$JOB_NAME /tmp/.horizon_environment/$JOB_NAME.old
|
||||
rm -rf /tmp/.horizon_environment/$JOB_NAME
|
||||
fi
|
||||
mkdir -p /tmp/.horizon_environment/$JOB_NAME
|
||||
cp -r $venv /tmp/.horizon_environment/$JOB_NAME/
|
||||
# Remove the backup now that we've completed successfully
|
||||
rm -rf /tmp/.horizon_environment/$JOB_NAME.old
|
||||
echo "Backup completed"
|
||||
fi
|
||||
}
|
||||
|
||||
function restore_environment {
|
||||
if [ $restore_env -eq 1 ]; then
|
||||
echo "Restoring environment from backup..."
|
||||
if [ ! -d /tmp/.horizon_environment/$JOB_NAME ]; then
|
||||
echo "No backup to restore from."
|
||||
return 0
|
||||
fi
|
||||
|
||||
cp -r /tmp/.horizon_environment/$JOB_NAME/.venv ./ || true
|
||||
|
||||
echo "Environment restored successfully."
|
||||
fi
|
||||
}
|
||||
|
||||
function install_venv {
|
||||
# Install with install_venv.py
|
||||
export PIP_DOWNLOAD_CACHE=${PIP_DOWNLOAD_CACHE-/tmp/.pip_download_cache}
|
||||
export PIP_USE_MIRRORS=true
|
||||
if [ $quiet -eq 1 ]; then
|
||||
export PIP_NO_INPUT=true
|
||||
fi
|
||||
echo "Fetching new src packages..."
|
||||
rm -rf $venv/src
|
||||
python tools/install_venv.py
|
||||
command_wrapper="$root/${with_venv}"
|
||||
# Make sure it worked and record the environment version
|
||||
sanity_check
|
||||
chmod -R 754 $venv
|
||||
cat requirements.txt test-requirements.txt > $venv_env_version
|
||||
}
|
||||
|
||||
function run_tests {
|
||||
sanity_check
|
||||
|
||||
if [ $with_selenium -eq 1 ]; then
|
||||
export WITH_SELENIUM=1
|
||||
elif [ $only_selenium -eq 1 ]; then
|
||||
export WITH_SELENIUM=1
|
||||
export SKIP_UNITTESTS=1
|
||||
fi
|
||||
|
||||
if [ $selenium_headless -eq 1 ]; then
|
||||
export SELENIUM_HEADLESS=1
|
||||
fi
|
||||
|
||||
if [ -z "$testargs" ]; then
|
||||
run_tests_all
|
||||
else
|
||||
run_tests_subset
|
||||
fi
|
||||
}
|
||||
|
||||
function run_tests_subset {
|
||||
project=`echo $testargs | awk -F. '{print $1}'`
|
||||
${command_wrapper} python $root/manage.py test --settings=$project.test.settings $testopts $testargs
|
||||
}
|
||||
|
||||
function run_tests_all {
|
||||
echo "Running craton_dashboard application tests"
|
||||
export NOSE_XUNIT_FILE=craton_dashboard/nosetests.xml
|
||||
if [ "$NOSE_WITH_HTML_OUTPUT" = '1' ]; then
|
||||
export NOSE_HTML_OUT_FILE='craton_dashboard_nose_results.html'
|
||||
fi
|
||||
if [ $with_coverage -eq 1 ]; then
|
||||
${command_wrapper} python -m coverage.__main__ erase
|
||||
coverage_run="python -m coverage.__main__ run -p"
|
||||
fi
|
||||
if [ $with_selenium -eq 0 -a $integration -eq 0 ]; then
|
||||
testopts="$testopts --exclude-dir=craton_dashboard/test/integration_tests"
|
||||
fi
|
||||
${command_wrapper} ${coverage_run} $root/manage.py test craton_dashboard --settings=craton_dashboard.test.settings $testopts
|
||||
# get results of the Horizon tests
|
||||
CRATON_DASHBOARD_RESULT=$?
|
||||
|
||||
if [ $with_coverage -eq 1 ]; then
|
||||
echo "Generating coverage reports"
|
||||
${command_wrapper} python -m coverage.__main__ combine
|
||||
${command_wrapper} python -m coverage.__main__ xml -i --omit='/usr*,setup.py,*egg*,.venv/*'
|
||||
${command_wrapper} python -m coverage.__main__ html -i --omit='/usr*,setup.py,*egg*,.venv/*' -d reports
|
||||
fi
|
||||
# Remove the leftover coverage files from the -p flag earlier.
|
||||
rm -f .coverage.*
|
||||
|
||||
PEP8_RESULT=0
|
||||
if [ $no_pep8 -eq 0 ] && [ $only_selenium -eq 0 ]; then
|
||||
run_pep8
|
||||
PEP8_RESULT=$?
|
||||
fi
|
||||
|
||||
TEST_RESULT=$(($CRATON_DASHBOARD_RESULT || $PEP8_RESULT))
|
||||
if [ $TEST_RESULT -eq 0 ]; then
|
||||
echo "Tests completed successfully."
|
||||
else
|
||||
echo "Tests failed."
|
||||
fi
|
||||
exit $TEST_RESULT
|
||||
}
|
||||
|
||||
function run_integration_tests {
|
||||
export INTEGRATION_TESTS=1
|
||||
|
||||
if [ $selenium_headless -eq 1 ]; then
|
||||
export SELENIUM_HEADLESS=1
|
||||
fi
|
||||
|
||||
export HORIZON_INTEGRATION_TESTS_CONFIG_FILE="craton_dashboard/test/integration_tests/horizon.conf"
|
||||
|
||||
echo "Running Horizon integration tests..."
|
||||
if [ -z "$testargs" ]; then
|
||||
${command_wrapper} nosetests craton_dashboard/test/integration_tests/tests
|
||||
else
|
||||
${command_wrapper} nosetests $testargs
|
||||
fi
|
||||
exit 0
|
||||
}
|
||||
|
||||
function run_makemessages {
|
||||
OPTS="-l en --no-obsolete --settings=openstack_dashboard.test.settings"
|
||||
DASHBOARD_OPTS="--extension=html,txt,csv --ignore=openstack"
|
||||
echo -n "horizon: "
|
||||
cd horizon
|
||||
${command_wrapper} $root/manage.py makemessages $OPTS
|
||||
HORIZON_PY_RESULT=$?
|
||||
echo -n "horizon javascript: "
|
||||
${command_wrapper} $root/manage.py makemessages -d djangojs $OPTS
|
||||
HORIZON_JS_RESULT=$?
|
||||
echo -n "openstack_dashboard: "
|
||||
cd ../openstack_dashboard
|
||||
${command_wrapper} $root/manage.py makemessages $DASHBOARD_OPTS $OPTS
|
||||
DASHBOARD_RESULT=$?
|
||||
cd ..
|
||||
if [ $check_only -eq 1 ]; then
|
||||
git checkout -- horizon/locale/en/LC_MESSAGES/django*.po
|
||||
git checkout -- openstack_dashboard/locale/en/LC_MESSAGES/django.po
|
||||
fi
|
||||
exit $(($HORIZON_PY_RESULT || $HORIZON_JS_RESULT || $DASHBOARD_RESULT))
|
||||
}
|
||||
|
||||
function run_compilemessages {
|
||||
OPTS="--settings=openstack_dashboard.test.settings"
|
||||
cd horizon
|
||||
${command_wrapper} $root/manage.py compilemessages $OPTS
|
||||
HORIZON_PY_RESULT=$?
|
||||
cd ../openstack_dashboard
|
||||
${command_wrapper} $root/manage.py compilemessages $OPTS
|
||||
DASHBOARD_RESULT=$?
|
||||
cd ..
|
||||
# English is the source language, so compiled catalogs are unnecessary.
|
||||
rm -vf horizon/locale/en/LC_MESSAGES/django*.mo
|
||||
rm -vf openstack_dashboard/locale/en/LC_MESSAGES/django.mo
|
||||
exit $(($HORIZON_PY_RESULT || $DASHBOARD_RESULT))
|
||||
}
|
||||
|
||||
function run_pseudo {
|
||||
for lang in $testargs
|
||||
# Use English po file as the source file/pot file just like real Horizon translations
|
||||
do
|
||||
${command_wrapper} $root/tools/pseudo.py openstack_dashboard/locale/en/LC_MESSAGES/django.po openstack_dashboard/locale/$lang/LC_MESSAGES/django.po $lang
|
||||
${command_wrapper} $root/tools/pseudo.py horizon/locale/en/LC_MESSAGES/django.po horizon/locale/$lang/LC_MESSAGES/django.po $lang
|
||||
${command_wrapper} $root/tools/pseudo.py horizon/locale/en/LC_MESSAGES/djangojs.po horizon/locale/$lang/LC_MESSAGES/djangojs.po $lang
|
||||
done
|
||||
exit $?
|
||||
}
|
||||
|
||||
|
||||
# ---------PREPARE THE ENVIRONMENT------------ #
|
||||
|
||||
# PROCESS ARGUMENTS, OVERRIDE DEFAULTS
|
||||
for arg in "$@"; do
|
||||
process_option $arg
|
||||
done
|
||||
|
||||
if [ $quiet -eq 1 ] && [ $never_venv -eq 0 ] && [ $always_venv -eq 0 ]
|
||||
then
|
||||
always_venv=1
|
||||
fi
|
||||
|
||||
# If destroy is set, just blow it away and exit.
|
||||
if [ $destroy -eq 1 ]; then
|
||||
destroy_venv
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Ignore all of this if the -N flag was set
|
||||
if [ $never_venv -eq 0 ]; then
|
||||
|
||||
# Restore previous environment if desired
|
||||
if [ $restore_env -eq 1 ]; then
|
||||
restore_environment
|
||||
fi
|
||||
|
||||
# Remove the virtual environment if --force used
|
||||
if [ $force -eq 1 ]; then
|
||||
destroy_venv
|
||||
fi
|
||||
|
||||
# Then check if it's up-to-date
|
||||
environment_check
|
||||
|
||||
# Create a backup of the up-to-date environment if desired
|
||||
if [ $backup_env -eq 1 ]; then
|
||||
backup_environment
|
||||
fi
|
||||
fi
|
||||
|
||||
# ---------EXERCISE THE CODE------------ #
|
||||
|
||||
# Run management commands
|
||||
if [ $manage -eq 1 ]; then
|
||||
run_management_command
|
||||
exit $?
|
||||
fi
|
||||
|
||||
# Build the docs
|
||||
if [ $just_docs -eq 1 ]; then
|
||||
run_sphinx
|
||||
exit $?
|
||||
fi
|
||||
|
||||
# Update translation files
|
||||
if [ $makemessages -eq 1 ]; then
|
||||
run_makemessages
|
||||
exit $?
|
||||
fi
|
||||
|
||||
# Compile translation files
|
||||
if [ $compilemessages -eq 1 ]; then
|
||||
run_compilemessages
|
||||
exit $?
|
||||
fi
|
||||
|
||||
# Generate Pseudo translation
|
||||
if [ $pseudo -eq 1 ]; then
|
||||
run_pseudo
|
||||
exit $?
|
||||
fi
|
||||
|
||||
# PEP8
|
||||
if [ $just_pep8 -eq 1 ]; then
|
||||
run_pep8
|
||||
exit $?
|
||||
fi
|
||||
|
||||
if [ $just_pep8_changed -eq 1 ]; then
|
||||
run_pep8_changed
|
||||
exit $?
|
||||
fi
|
||||
|
||||
# Pylint
|
||||
if [ $just_pylint -eq 1 ]; then
|
||||
run_pylint
|
||||
exit $?
|
||||
fi
|
||||
|
||||
# Tab checker
|
||||
if [ $just_tabs -eq 1 ]; then
|
||||
tab_check
|
||||
exit $?
|
||||
fi
|
||||
|
||||
# Integration tests
|
||||
if [ $integration -eq 1 ]; then
|
||||
run_integration_tests
|
||||
exit $?
|
||||
fi
|
||||
|
||||
# Django development server
|
||||
if [ $runserver -eq 1 ]; then
|
||||
run_server
|
||||
exit $?
|
||||
fi
|
||||
|
||||
# Full test suite
|
||||
run_tests || exit
|
34
setup.cfg
34
setup.cfg
|
@ -1,34 +0,0 @@
|
|||
[metadata]
|
||||
name = craton-dashboard
|
||||
summary = The Craton UI for Horizon Dashboard
|
||||
description-file =
|
||||
README.rst
|
||||
author = OSIC
|
||||
author_email = eddie.ramirez@intel.com
|
||||
home-page = http://www.openstack.org/
|
||||
classifiers = [
|
||||
Environment :: OpenStack
|
||||
Framework :: Django
|
||||
Intended Audience :: Developers
|
||||
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 :: 3
|
||||
Programming Language :: Python :: 3.3
|
||||
Programming Language :: Python :: 3.4
|
||||
Programming Language :: Python :: 3.5
|
||||
|
||||
[files]
|
||||
packages =
|
||||
craton_dashboard
|
||||
|
||||
[build_sphinx]
|
||||
source-dir = doc/source
|
||||
build-dir = doc/build
|
||||
all_files = 1
|
||||
|
||||
[upload_sphinx]
|
||||
upload-dir = doc/build/html
|
29
setup.py
29
setup.py
|
@ -1,29 +0,0 @@
|
|||
# Copyright (c) 2016 Intel Corporation
|
||||
#
|
||||
# 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>=1.8'],
|
||||
pbr=True)
|
|
@ -1,25 +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.12,>=0.10.0
|
||||
coverage>=3.6
|
||||
ddt>=1.0.1 # MIT
|
||||
django-nose>=1.4.4 # BSD
|
||||
reno>=1.8.0 # Apache2
|
||||
mock>=2.0 # BSD
|
||||
mox3>=0.7.0 # Apache-2.0
|
||||
nodeenv>=0.9.4 # BSD License # BSD
|
||||
netifaces>=0.10.4 # MIT
|
||||
nose # LGPL
|
||||
nose-exclude # LGPL
|
||||
nosehtmloutput>=0.0.3 # Apache-2.0
|
||||
nosexcover # BSD
|
||||
openstack.nose-plugin>=0.7 # Apache-2.0
|
||||
python-subunit>=0.0.18
|
||||
sphinx!=1.2.0,!=1.3b1,<1.3,>=1.1.2
|
||||
oslosphinx>=2.5.0 # Apache-2.0
|
||||
oslotest>=1.10.0 # Apache-2.0
|
||||
testrepository>=0.0.18
|
||||
testscenarios>=0.4
|
||||
testtools>=1.4.0
|
|
@ -1,158 +0,0 @@
|
|||
# Copyright 2012 United States Government as represented by the
|
||||
# Administrator of the National Aeronautics and Space Administration.
|
||||
# All Rights Reserved.
|
||||
#
|
||||
# Copyright 2012 OpenStack, LLC
|
||||
#
|
||||
# Copyright 2012 Nebula, Inc.
|
||||
#
|
||||
# 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.
|
||||
|
||||
"""
|
||||
Installation script for the OpenStack Dashboard development virtualenv.
|
||||
"""
|
||||
|
||||
import os
|
||||
import subprocess
|
||||
import sys
|
||||
|
||||
|
||||
ROOT = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
|
||||
VENV = os.path.join(ROOT, '.venv')
|
||||
WITH_VENV = os.path.join(ROOT, 'tools', 'with_venv.sh')
|
||||
PIP_REQUIRES = os.path.join(ROOT, 'requirements.txt')
|
||||
TEST_REQUIRES = os.path.join(ROOT, 'test-requirements.txt')
|
||||
PIP_INSTALL_WRAPPER = os.path.join(ROOT, 'tools', 'pip_install.sh')
|
||||
|
||||
|
||||
def die(message, *args):
|
||||
print(sys.stderr, message % args)
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def run_command(cmd, redirect_output=True, check_exit_code=True, cwd=ROOT,
|
||||
die_message=None):
|
||||
"""
|
||||
|
||||
Run a command in an out-of-process shell, returning the
|
||||
output of that command. Working directory is ROOT."""
|
||||
if redirect_output:
|
||||
stdout = subprocess.PIPE
|
||||
else:
|
||||
stdout = None
|
||||
|
||||
proc = subprocess.Popen(cmd, cwd=cwd, stdout=stdout)
|
||||
output = proc.communicate()[0]
|
||||
if check_exit_code and proc.returncode != 0:
|
||||
if die_message is None:
|
||||
die('Command "%s" failed.\n%s', ' '.join(cmd), output)
|
||||
else:
|
||||
die(die_message)
|
||||
return output
|
||||
|
||||
|
||||
HAS_EASY_INSTALL = bool(run_command(['which', 'easy_install'],
|
||||
check_exit_code=False).strip())
|
||||
HAS_VIRTUALENV = bool(run_command(['which', 'virtualenv'],
|
||||
check_exit_code=False).strip())
|
||||
|
||||
|
||||
def check_dependencies():
|
||||
"""Make sure virtualenv is in the path."""
|
||||
print('Checking dependencies...')
|
||||
if not HAS_VIRTUALENV:
|
||||
print ('Virtual environment not found.')
|
||||
# Try installing it via easy_install...
|
||||
if HAS_EASY_INSTALL:
|
||||
print ('Installing virtualenv via easy_install...',
|
||||
run_command(['easy_install', 'virtualenv'],
|
||||
die_message='easy_install failed to install '
|
||||
'virtualenv\ndevelopment requires '
|
||||
'virtualenv, please install it '
|
||||
'using your favorite tool'))
|
||||
if not run_command(['which', 'virtualenv']):
|
||||
die('ERROR: virtualenv not found in path.\n\ndevelopment '
|
||||
' requires virtualenv, please install it using your'
|
||||
' favorite package management tool and ensure'
|
||||
' virtualenv is in your path')
|
||||
print('virtualenv installation done.')
|
||||
else:
|
||||
die('easy_install not found.\n\nInstall easy_install'
|
||||
' (python-setuptools in ubuntu) or virtualenv by hand,'
|
||||
' then rerun.')
|
||||
print('dependency check done.')
|
||||
|
||||
|
||||
def create_virtualenv(venv=VENV):
|
||||
"""Creates the virtual environment and installs PIP only into the
|
||||
virtual environment
|
||||
"""
|
||||
print('Creating venv...'),
|
||||
run_command(['virtualenv', '-q', '--no-site-packages', VENV])
|
||||
print('done.')
|
||||
print('Installing pip in virtualenv...'),
|
||||
if not run_command([WITH_VENV, 'easy_install', 'pip']).strip():
|
||||
die("Failed to install pip.")
|
||||
print('done.')
|
||||
print('Installing distribute in virtualenv...')
|
||||
pip_install('distribute>=0.6.24')
|
||||
print('done.')
|
||||
|
||||
|
||||
def pip_install(*args):
|
||||
args = [WITH_VENV, 'pip', 'install', '--upgrade'] + list(args)
|
||||
run_command(args, redirect_output=False)
|
||||
|
||||
|
||||
def pip_install_with_horizon(*args):
|
||||
args = [WITH_VENV, PIP_INSTALL_WRAPPER, 'unconstrained'] + list(args)
|
||||
run_command(args, redirect_output=False)
|
||||
|
||||
|
||||
def install_dependencies(venv=VENV):
|
||||
print("Installing dependencies...")
|
||||
print("(This may take several minutes, don't panic)")
|
||||
pip_install_with_horizon('-r', TEST_REQUIRES)
|
||||
pip_install_with_horizon('-r', PIP_REQUIRES)
|
||||
|
||||
# Tell the virtual env how to "import dashboard"
|
||||
py = 'python%d.%d' % (sys.version_info[0], sys.version_info[1])
|
||||
pthfile = os.path.join(venv, "lib", py, "site-packages", "dashboard.pth")
|
||||
f = open(pthfile, 'w')
|
||||
f.write("%s\n" % ROOT)
|
||||
|
||||
|
||||
def install_horizon():
|
||||
print('Installing horizon module in development mode...')
|
||||
run_command([WITH_VENV, 'python', 'setup.py', 'develop'], cwd=ROOT)
|
||||
|
||||
|
||||
def print_summary():
|
||||
summary = """
|
||||
Horizon development environment setup is complete.
|
||||
To activate the virtualenv for the extent of your current shell session you
|
||||
can run:
|
||||
$ source .venv/bin/activate
|
||||
"""
|
||||
print(summary)
|
||||
|
||||
|
||||
def main():
|
||||
check_dependencies()
|
||||
create_virtualenv()
|
||||
install_dependencies()
|
||||
install_horizon()
|
||||
print_summary()
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
|
@ -1,67 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
# The original script is borrowed from neutron-* repos.
|
||||
|
||||
# Many of horizon's repos suffer from the problem of depending on horizon,
|
||||
# but it not existing on pypi.
|
||||
|
||||
# This wrapper for tox's package installer will use the existing package
|
||||
# if it exists, else use zuul-cloner if that program exists, else grab it
|
||||
# from horizon master via a hard-coded URL. That last case should only
|
||||
# happen with devs running unit tests locally.
|
||||
|
||||
# From the tox.ini config page:
|
||||
# install_command=ARGV
|
||||
# default:
|
||||
# pip install {opts} {packages}
|
||||
|
||||
ZUUL_CLONER=/usr/zuul-env/bin/zuul-cloner
|
||||
BRANCH_NAME=master
|
||||
horizon_installed=$(echo "import horizon" | python 2>/dev/null ; echo $?)
|
||||
|
||||
set -e
|
||||
|
||||
zuul_install () {
|
||||
if [ -x "$ZUUL_CLONER" ]; then
|
||||
export ZUUL_BRANCH=${ZUUL_BRANCH-$BRANCH}
|
||||
echo "ZUUL CLONER" > /tmp/tox_install.txt
|
||||
cwd=$(/bin/pwd)
|
||||
cd /tmp
|
||||
$ZUUL_CLONER --cache-dir \
|
||||
/opt/git \
|
||||
--branch $BRANCH_NAME \
|
||||
git://git.openstack.org \
|
||||
openstack/horizon
|
||||
cd openstack/horizon
|
||||
$install_cmd -e .
|
||||
cd "$cwd"
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
usual_install () {
|
||||
echo "PIP HARDCODE" > /tmp/tox_install.txt
|
||||
if [ -z "$HORIZON_PIP_LOCATION" ]; then
|
||||
HORIZON_PIP_LOCATION="git+https://git.openstack.org/openstack/horizon@$BRANCH_NAME#egg=horizon"
|
||||
fi
|
||||
$install_cmd -U -e ${HORIZON_PIP_LOCATION}
|
||||
|
||||
}
|
||||
|
||||
install_cmd="pip install"
|
||||
if [ "$1" = "constrained" ]; then
|
||||
install_cmd="$install_cmd $2"
|
||||
shift
|
||||
fi
|
||||
shift
|
||||
|
||||
if [ $horizon_installed -eq 0 ]; then
|
||||
echo "ALREADY INSTALLED" > /tmp/tox_install.txt
|
||||
echo "Horizon already installed; using existing package"
|
||||
else
|
||||
zuul_install || usual_install
|
||||
fi
|
||||
|
||||
$install_cmd -U $*
|
||||
exit $?
|
|
@ -1,7 +0,0 @@
|
|||
#!/bin/bash
|
||||
TOOLS_PATH=${TOOLS_PATH:-$(dirname $0)}
|
||||
VENV_PATH=${VENV_PATH:-${TOOLS_PATH}}
|
||||
VENV_DIR=${VENV_NAME:-/../.venv}
|
||||
TOOLS=${TOOLS_PATH}
|
||||
VENV=${VENV:-${VENV_PATH}/${VENV_DIR}}
|
||||
source ${VENV}/bin/activate && "$@"
|
99
tox.ini
99
tox.ini
|
@ -1,99 +0,0 @@
|
|||
[tox]
|
||||
minversion = 2.0
|
||||
envlist = py35,py34,py27,pep8,py27dj18
|
||||
skipsdist = True
|
||||
|
||||
[testenv]
|
||||
usedevelop = True
|
||||
install_command =
|
||||
{toxinidir}/tools/pip_install.sh unconstrained {opts} {packages}
|
||||
setenv =
|
||||
VIRTUAL_ENV={envdir}
|
||||
deps = -r{toxinidir}/requirements.txt
|
||||
-r{toxinidir}/test-requirements.txt
|
||||
whitelist_externals = /bin/bash
|
||||
commands =
|
||||
# Try to detect whether a limited test suite is being specified and if so
|
||||
# direct the testing to that suite's project; otherwise run the full suite
|
||||
bash -c 'project=`echo {posargs} | cut -d. -f1`; \
|
||||
if [ -z "$project" ]; then \
|
||||
EXIT_STATUS=0; \
|
||||
{envpython} {toxinidir}/manage.py test craton_dashboard --settings=craton_dashboard.test.settings {posargs} || EXIT_STATUS=$?; \
|
||||
exit $EXIT_STATUS; \
|
||||
else \
|
||||
{envpython} {toxinidir}/manage.py test {posargs} --settings=$project.test.settings --exclude-dir=craton_dashboard/test/integration_tests; \
|
||||
fi'
|
||||
|
||||
[testenv:py27]
|
||||
basepython = python2.7
|
||||
setenv =
|
||||
{[testenv]setenv}
|
||||
PYTHONUNBUFFERED=1
|
||||
|
||||
[testenv:py34]
|
||||
basepython = python3.4
|
||||
setenv =
|
||||
{[testenv]setenv}
|
||||
PYTHONUNBUFFERED=1
|
||||
|
||||
[testenv:py35]
|
||||
basepython = python3.5
|
||||
setenv =
|
||||
{[testenv]setenv}
|
||||
PYTHONUNBUFFERED=1
|
||||
|
||||
[testenv:pep8]
|
||||
commands = flake8
|
||||
|
||||
[testenv:venv]
|
||||
commands = {posargs}
|
||||
|
||||
# Django-1.8 is LTS
|
||||
[testenv:py27dj18]
|
||||
basepython = python2.7
|
||||
commands = pip install django>=1.8,<1.9
|
||||
/bin/bash run_tests.sh -N --no-pep8 {posargs}
|
||||
|
||||
[testenv:py27dj19]
|
||||
basepython = python2.7
|
||||
commands = pip install django>=1.9,<1.10
|
||||
/bin/bash run_tests.sh -N --no-pep8 {posargs}
|
||||
|
||||
[testenv:py27dj110]
|
||||
basepython = python2.7
|
||||
commands = pip install django --pre --upgrade
|
||||
/bin/bash run_tests.sh -N --no-pep8 {posargs}
|
||||
|
||||
[testenv:npm]
|
||||
commands =
|
||||
nodeenv -p
|
||||
npm install
|
||||
npm run {posargs:test}
|
||||
|
||||
[testenv:releasenotes]
|
||||
commands = sphinx-build -a -E -W -d releasenotes/build/doctrees -b html releasenotes/source releasenotes/build/html
|
||||
|
||||
[testenv:cover]
|
||||
commands = python setup.py testr --coverage --testr-args='{posargs}'
|
||||
|
||||
[testenv:docs]
|
||||
commands = python setup.py build_sphinx
|
||||
|
||||
[testenv:debug]
|
||||
commands = oslo_debug_helper {posargs}
|
||||
|
||||
[flake8]
|
||||
show-source = True
|
||||
# E123, E125 skipped as they are invalid PEP-8.
|
||||
# H405 multi line docstring summary not separated with an empty line
|
||||
ignore = E123,E125,H405
|
||||
builtins = _
|
||||
exclude=.venv,.git,.tox,dist,doc,*lib/python*,*egg,build,.ropeproject,tools,node_modules
|
||||
|
||||
[testenv:bindep]
|
||||
# Do not install any requirements. We want this to be fast and work even if
|
||||
# system dependencies are missing, since it's used to tell you what system
|
||||
# dependencies are missing! This also means that bindep must be installed
|
||||
# separately, outside of the requirements files.
|
||||
deps = bindep
|
||||
commands = bindep test
|
Loading…
Reference in New Issue