Merge lp:~devcamcar/django-nova/move-django-nova into lp:django-nova

Proposed by Devin Carlen
Status: Merged
Approved by: Devin Carlen
Approved revision: 20
Merged at revision: 20
Proposed branch: lp:~devcamcar/django-nova/move-django-nova
Merge into: lp:django-nova
Diff against target: 7292 lines (+5/-6810)
88 files modified
LICENSE (+0/-176)
README (+5/-41)
bootstrap.py (+0/-260)
buildout.cfg (+0/-19)
setup.py (+0/-29)
src/django_nova/adminclient.py (+0/-498)
src/django_nova/connection.py (+0/-38)
src/django_nova/exceptions.py (+0/-95)
src/django_nova/forms.py (+0/-262)
src/django_nova/management/commands/createnovausers.py (+0/-37)
src/django_nova/manager.py (+0/-340)
src/django_nova/models.py (+0/-121)
src/django_nova/shortcuts.py (+0/-131)
src/django_nova/templates/admin/django_nova/project/add_project.html (+0/-45)
src/django_nova/templates/admin/django_nova/project/add_project_user.html (+0/-69)
src/django_nova/templates/admin/django_nova/project/base_projects.html (+0/-16)
src/django_nova/templates/admin/django_nova/project/change_list.html (+0/-3)
src/django_nova/templates/admin/django_nova/project/delete_project.html (+0/-25)
src/django_nova/templates/admin/django_nova/project/delete_project_user.html (+0/-25)
src/django_nova/templates/admin/django_nova/project/edit_project.html (+0/-95)
src/django_nova/templates/admin/django_nova/project/global_edit_user.html (+0/-71)
src/django_nova/templates/admin/django_nova/project/project_list.html (+0/-42)
src/django_nova/templates/admin/django_nova/project/project_user.html (+0/-76)
src/django_nova/templates/admin/django_nova/project/send_credentials.html (+0/-87)
src/django_nova/templates/admin/django_nova/project/user_list.html (+0/-39)
src/django_nova/templates/django_nova/_messages.html (+0/-41)
src/django_nova/templates/django_nova/base.html (+0/-85)
src/django_nova/templates/django_nova/credentials/expired.html (+0/-17)
src/django_nova/templates/django_nova/images/_launch_form.html (+0/-7)
src/django_nova/templates/django_nova/images/_list.html (+0/-112)
src/django_nova/templates/django_nova/images/base.html (+0/-7)
src/django_nova/templates/django_nova/images/detail_list.html (+0/-207)
src/django_nova/templates/django_nova/images/edit.html (+0/-35)
src/django_nova/templates/django_nova/images/index.html (+0/-70)
src/django_nova/templates/django_nova/images/launch.html (+0/-32)
src/django_nova/templates/django_nova/instances/_instances_list.html (+0/-104)
src/django_nova/templates/django_nova/instances/base.html (+0/-7)
src/django_nova/templates/django_nova/instances/detail_list.html (+0/-33)
src/django_nova/templates/django_nova/instances/edit.html (+0/-34)
src/django_nova/templates/django_nova/instances/index.html (+0/-98)
src/django_nova/templates/django_nova/instances/performance.html (+0/-58)
src/django_nova/templates/django_nova/keypairs/_create_form.html (+0/-5)
src/django_nova/templates/django_nova/keypairs/_list.html (+0/-31)
src/django_nova/templates/django_nova/keypairs/base.html (+0/-7)
src/django_nova/templates/django_nova/keypairs/index.html (+0/-77)
src/django_nova/templates/django_nova/projects/edit_user.html (+0/-72)
src/django_nova/templates/django_nova/projects/index.html (+0/-26)
src/django_nova/templates/django_nova/projects/manage.html (+0/-45)
src/django_nova/templates/django_nova/securitygroups/_authorize_form.html (+0/-5)
src/django_nova/templates/django_nova/securitygroups/_create_form.html (+0/-5)
src/django_nova/templates/django_nova/securitygroups/_revoke_form.html (+0/-3)
src/django_nova/templates/django_nova/securitygroups/base.html (+0/-7)
src/django_nova/templates/django_nova/securitygroups/detail.html (+0/-62)
src/django_nova/templates/django_nova/securitygroups/index.html (+0/-59)
src/django_nova/templates/django_nova/volumes/_attach_form.html (+0/-5)
src/django_nova/templates/django_nova/volumes/_create_form.html (+0/-5)
src/django_nova/templates/django_nova/volumes/base.html (+0/-7)
src/django_nova/templates/django_nova/volumes/index.html (+0/-84)
src/django_nova/templatetags/admin_extras.py (+0/-50)
src/django_nova/templatetags/django_nova_tags.py (+0/-37)
src/django_nova/templatetags/project_tags.py (+0/-39)
src/django_nova/templatetags/region_tags.py (+0/-40)
src/django_nova/templatetags/sidebar_tags.py (+0/-46)
src/django_nova/templatetags/truncate_filter.py (+0/-31)
src/django_nova/tests/__init__.py (+0/-1)
src/django_nova/tests/urls.py (+0/-36)
src/django_nova/tests/view_tests/__init__.py (+0/-7)
src/django_nova/tests/view_tests/base.py (+0/-90)
src/django_nova/tests/view_tests/credential_tests.py (+0/-70)
src/django_nova/tests/view_tests/image_tests.py (+0/-232)
src/django_nova/tests/view_tests/instance_tests.py (+0/-67)
src/django_nova/tests/view_tests/keypair_tests.py (+0/-93)
src/django_nova/tests/view_tests/region_tests.py (+0/-43)
src/django_nova/tests/view_tests/volume_tests.py (+0/-170)
src/django_nova/testsettings.py (+0/-21)
src/django_nova/urls/admin_project.py (+0/-55)
src/django_nova/urls/admin_roles.py (+0/-32)
src/django_nova/urls/project.py (+0/-129)
src/django_nova/urls/region.py (+0/-29)
src/django_nova/views/admin.py (+0/-326)
src/django_nova/views/credentials.py (+0/-46)
src/django_nova/views/images.py (+0/-229)
src/django_nova/views/instances.py (+0/-203)
src/django_nova/views/keypairs.py (+0/-122)
src/django_nova/views/projects.py (+0/-107)
src/django_nova/views/regions.py (+0/-36)
src/django_nova/views/securitygroups.py (+0/-180)
src/django_nova/views/volumes.py (+0/-151)
To merge this branch: bzr merge lp:~devcamcar/django-nova/move-django-nova
Reviewer Review Type Date Requested Status
Devin Carlen Pending
Review via email: mp+52312@code.launchpad.net

Description of the change

The Django-Nova repository is decommissioned. It is now part of the OpenStack Dashboard repository located at:

http://launchpad.net/openstack-dashboard

To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== removed file 'LICENSE'
--- LICENSE 2011-01-12 20:02:06 +0000
+++ LICENSE 1970-01-01 00:00:00 +0000
@@ -1,176 +0,0 @@
1
2 Apache License
3 Version 2.0, January 2004
4 http://www.apache.org/licenses/
5
6 TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
8 1. Definitions.
9
10 "License" shall mean the terms and conditions for use, reproduction,
11 and distribution as defined by Sections 1 through 9 of this document.
12
13 "Licensor" shall mean the copyright owner or entity authorized by
14 the copyright owner that is granting the License.
15
16 "Legal Entity" shall mean the union of the acting entity and all
17 other entities that control, are controlled by, or are under common
18 control with that entity. For the purposes of this definition,
19 "control" means (i) the power, direct or indirect, to cause the
20 direction or management of such entity, whether by contract or
21 otherwise, or (ii) ownership of fifty percent (50%) or more of the
22 outstanding shares, or (iii) beneficial ownership of such entity.
23
24 "You" (or "Your") shall mean an individual or Legal Entity
25 exercising permissions granted by this License.
26
27 "Source" form shall mean the preferred form for making modifications,
28 including but not limited to software source code, documentation
29 source, and configuration files.
30
31 "Object" form shall mean any form resulting from mechanical
32 transformation or translation of a Source form, including but
33 not limited to compiled object code, generated documentation,
34 and conversions to other media types.
35
36 "Work" shall mean the work of authorship, whether in Source or
37 Object form, made available under the License, as indicated by a
38 copyright notice that is included in or attached to the work
39 (an example is provided in the Appendix below).
40
41 "Derivative Works" shall mean any work, whether in Source or Object
42 form, that is based on (or derived from) the Work and for which the
43 editorial revisions, annotations, elaborations, or other modifications
44 represent, as a whole, an original work of authorship. For the purposes
45 of this License, Derivative Works shall not include works that remain
46 separable from, or merely link (or bind by name) to the interfaces of,
47 the Work and Derivative Works thereof.
48
49 "Contribution" shall mean any work of authorship, including
50 the original version of the Work and any modifications or additions
51 to that Work or Derivative Works thereof, that is intentionally
52 submitted to Licensor for inclusion in the Work by the copyright owner
53 or by an individual or Legal Entity authorized to submit on behalf of
54 the copyright owner. For the purposes of this definition, "submitted"
55 means any form of electronic, verbal, or written communication sent
56 to the Licensor or its representatives, including but not limited to
57 communication on electronic mailing lists, source code control systems,
58 and issue tracking systems that are managed by, or on behalf of, the
59 Licensor for the purpose of discussing and improving the Work, but
60 excluding communication that is conspicuously marked or otherwise
61 designated in writing by the copyright owner as "Not a Contribution."
62
63 "Contributor" shall mean Licensor and any individual or Legal Entity
64 on behalf of whom a Contribution has been received by Licensor and
65 subsequently incorporated within the Work.
66
67 2. Grant of Copyright License. Subject to the terms and conditions of
68 this License, each Contributor hereby grants to You a perpetual,
69 worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70 copyright license to reproduce, prepare Derivative Works of,
71 publicly display, publicly perform, sublicense, and distribute the
72 Work and such Derivative Works in Source or Object form.
73
74 3. Grant of Patent License. Subject to the terms and conditions of
75 this License, each Contributor hereby grants to You a perpetual,
76 worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77 (except as stated in this section) patent license to make, have made,
78 use, offer to sell, sell, import, and otherwise transfer the Work,
79 where such license applies only to those patent claims licensable
80 by such Contributor that are necessarily infringed by their
81 Contribution(s) alone or by combination of their Contribution(s)
82 with the Work to which such Contribution(s) was submitted. If You
83 institute patent litigation against any entity (including a
84 cross-claim or counterclaim in a lawsuit) alleging that the Work
85 or a Contribution incorporated within the Work constitutes direct
86 or contributory patent infringement, then any patent licenses
87 granted to You under this License for that Work shall terminate
88 as of the date such litigation is filed.
89
90 4. Redistribution. You may reproduce and distribute copies of the
91 Work or Derivative Works thereof in any medium, with or without
92 modifications, and in Source or Object form, provided that You
93 meet the following conditions:
94
95 (a) You must give any other recipients of the Work or
96 Derivative Works a copy of this License; and
97
98 (b) You must cause any modified files to carry prominent notices
99 stating that You changed the files; and
100
101 (c) You must retain, in the Source form of any Derivative Works
102 that You distribute, all copyright, patent, trademark, and
103 attribution notices from the Source form of the Work,
104 excluding those notices that do not pertain to any part of
105 the Derivative Works; and
106
107 (d) If the Work includes a "NOTICE" text file as part of its
108 distribution, then any Derivative Works that You distribute must
109 include a readable copy of the attribution notices contained
110 within such NOTICE file, excluding those notices that do not
111 pertain to any part of the Derivative Works, in at least one
112 of the following places: within a NOTICE text file distributed
113 as part of the Derivative Works; within the Source form or
114 documentation, if provided along with the Derivative Works; or,
115 within a display generated by the Derivative Works, if and
116 wherever such third-party notices normally appear. The contents
117 of the NOTICE file are for informational purposes only and
118 do not modify the License. You may add Your own attribution
119 notices within Derivative Works that You distribute, alongside
120 or as an addendum to the NOTICE text from the Work, provided
121 that such additional attribution notices cannot be construed
122 as modifying the License.
123
124 You may add Your own copyright statement to Your modifications and
125 may provide additional or different license terms and conditions
126 for use, reproduction, or distribution of Your modifications, or
127 for any such Derivative Works as a whole, provided Your use,
128 reproduction, and distribution of the Work otherwise complies with
129 the conditions stated in this License.
130
131 5. Submission of Contributions. Unless You explicitly state otherwise,
132 any Contribution intentionally submitted for inclusion in the Work
133 by You to the Licensor shall be under the terms and conditions of
134 this License, without any additional terms or conditions.
135 Notwithstanding the above, nothing herein shall supersede or modify
136 the terms of any separate license agreement you may have executed
137 with Licensor regarding such Contributions.
138
139 6. Trademarks. This License does not grant permission to use the trade
140 names, trademarks, service marks, or product names of the Licensor,
141 except as required for reasonable and customary use in describing the
142 origin of the Work and reproducing the content of the NOTICE file.
143
144 7. Disclaimer of Warranty. Unless required by applicable law or
145 agreed to in writing, Licensor provides the Work (and each
146 Contributor provides its Contributions) on an "AS IS" BASIS,
147 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148 implied, including, without limitation, any warranties or conditions
149 of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150 PARTICULAR PURPOSE. You are solely responsible for determining the
151 appropriateness of using or redistributing the Work and assume any
152 risks associated with Your exercise of permissions under this License.
153
154 8. Limitation of Liability. In no event and under no legal theory,
155 whether in tort (including negligence), contract, or otherwise,
156 unless required by applicable law (such as deliberate and grossly
157 negligent acts) or agreed to in writing, shall any Contributor be
158 liable to You for damages, including any direct, indirect, special,
159 incidental, or consequential damages of any character arising as a
160 result of this License or out of the use or inability to use the
161 Work (including but not limited to damages for loss of goodwill,
162 work stoppage, computer failure or malfunction, or any and all
163 other commercial damages or losses), even if such Contributor
164 has been advised of the possibility of such damages.
165
166 9. Accepting Warranty or Additional Liability. While redistributing
167 the Work or Derivative Works thereof, You may choose to offer,
168 and charge a fee for, acceptance of support, warranty, indemnity,
169 or other liability obligations and/or rights consistent with this
170 License. However, in accepting such obligations, You may act only
171 on Your own behalf and on Your sole responsibility, not on behalf
172 of any other Contributor, and only if You agree to indemnify,
173 defend, and hold each Contributor harmless for any liability
174 incurred by, or claims asserted against, such Contributor by reason
175 of your accepting any such warranty or additional liability.
176
1770
=== modified file 'README'
--- README 2011-01-12 22:23:24 +0000
+++ README 2011-03-05 22:32:56 +0000
@@ -1,42 +1,6 @@
1OpenStack Django-Nova1Django-Nova has been moved into the OpenStack Dashboard repository.
2---------------------2
33It's new home is at:
4The Django-Nova project is a Django module that is used to provide web based4
5interactions with the OpenStack Nova cloud controller.5 http://launchpad.net/openstack-dashboard
6
7There is a reference implementation that uses this module located at:
8
9 http://launchpad.net/openstack-dashboard
10
11It is highly recommended that you make use of this reference implementation
12so that changes you make can be visualized effectively and are consistent.
13Using this reference implementation as a development environment will greatly
14simplify development of the django-nova module.
15
16Of course, if you are developing your own Django site using django-nova, then
17you can disregard this advice.
18
19
20
21Getting Started
22---------------
23
24Django-Nova uses Buildout (http://www.buildout.org/) to manage local
25development. To configure your local Buildout environment:
26
27 $ python bootstrap.py
28 $ bin/buildout
29
30This will install all the dependencies of django-nova and provide some useful
31scripts in the bin/ directory:
32
33 bin/python provides a python shell for the current buildout.
34 bin/django provides django functions for the current buildout.
35
36
37You should now be able to run unit tests as follows:
38
39 $ bin/django test
40
41
426
437
=== removed file 'bootstrap.py'
--- bootstrap.py 2011-01-12 20:02:06 +0000
+++ bootstrap.py 1970-01-01 00:00:00 +0000
@@ -1,260 +0,0 @@
1##############################################################################
2#
3# Copyright (c) 2006 Zope Foundation and Contributors.
4# All Rights Reserved.
5#
6# This software is subject to the provisions of the Zope Public License,
7# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
8# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
9# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
10# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
11# FOR A PARTICULAR PURPOSE.
12#
13##############################################################################
14"""Bootstrap a buildout-based project
15
16Simply run this script in a directory containing a buildout.cfg.
17The script accepts buildout command-line options, so you can
18use the -c option to specify an alternate configuration file.
19"""
20
21import os, shutil, sys, tempfile, textwrap, urllib, urllib2, subprocess
22from optparse import OptionParser
23
24if sys.platform == 'win32':
25 def quote(c):
26 if ' ' in c:
27 return '"%s"' % c # work around spawn lamosity on windows
28 else:
29 return c
30else:
31 quote = str
32
33# See zc.buildout.easy_install._has_broken_dash_S for motivation and comments.
34stdout, stderr = subprocess.Popen(
35 [sys.executable, '-Sc',
36 'try:\n'
37 ' import ConfigParser\n'
38 'except ImportError:\n'
39 ' print 1\n'
40 'else:\n'
41 ' print 0\n'],
42 stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate()
43has_broken_dash_S = bool(int(stdout.strip()))
44
45# In order to be more robust in the face of system Pythons, we want to
46# run without site-packages loaded. This is somewhat tricky, in
47# particular because Python 2.6's distutils imports site, so starting
48# with the -S flag is not sufficient. However, we'll start with that:
49if not has_broken_dash_S and 'site' in sys.modules:
50 # We will restart with python -S.
51 args = sys.argv[:]
52 args[0:0] = [sys.executable, '-S']
53 args = map(quote, args)
54 os.execv(sys.executable, args)
55# Now we are running with -S. We'll get the clean sys.path, import site
56# because distutils will do it later, and then reset the path and clean
57# out any namespace packages from site-packages that might have been
58# loaded by .pth files.
59clean_path = sys.path[:]
60import site
61sys.path[:] = clean_path
62for k, v in sys.modules.items():
63 if k in ('setuptools', 'pkg_resources') or (
64 hasattr(v, '__path__') and
65 len(v.__path__)==1 and
66 not os.path.exists(os.path.join(v.__path__[0],'__init__.py'))):
67 # This is a namespace package. Remove it.
68 sys.modules.pop(k)
69
70is_jython = sys.platform.startswith('java')
71
72setuptools_source = 'http://peak.telecommunity.com/dist/ez_setup.py'
73distribute_source = 'http://python-distribute.org/distribute_setup.py'
74
75# parsing arguments
76def normalize_to_url(option, opt_str, value, parser):
77 if value:
78 if '://' not in value: # It doesn't smell like a URL.
79 value = 'file://%s' % (
80 urllib.pathname2url(
81 os.path.abspath(os.path.expanduser(value))),)
82 if opt_str == '--download-base' and not value.endswith('/'):
83 # Download base needs a trailing slash to make the world happy.
84 value += '/'
85 else:
86 value = None
87 name = opt_str[2:].replace('-', '_')
88 setattr(parser.values, name, value)
89
90usage = '''\
91[DESIRED PYTHON FOR BUILDOUT] bootstrap.py [options]
92
93Bootstraps a buildout-based project.
94
95Simply run this script in a directory containing a buildout.cfg, using the
96Python that you want bin/buildout to use.
97
98Note that by using --setup-source and --download-base to point to
99local resources, you can keep this script from going over the network.
100'''
101
102parser = OptionParser(usage=usage)
103parser.add_option("-v", "--version", dest="version",
104 help="use a specific zc.buildout version")
105parser.add_option("-d", "--distribute",
106 action="store_true", dest="use_distribute", default=False,
107 help="Use Distribute rather than Setuptools.")
108parser.add_option("--setup-source", action="callback", dest="setup_source",
109 callback=normalize_to_url, nargs=1, type="string",
110 help=("Specify a URL or file location for the setup file. "
111 "If you use Setuptools, this will default to " +
112 setuptools_source + "; if you use Distribute, this "
113 "will default to " + distribute_source +"."))
114parser.add_option("--download-base", action="callback", dest="download_base",
115 callback=normalize_to_url, nargs=1, type="string",
116 help=("Specify a URL or directory for downloading "
117 "zc.buildout and either Setuptools or Distribute. "
118 "Defaults to PyPI."))
119parser.add_option("--eggs",
120 help=("Specify a directory for storing eggs. Defaults to "
121 "a temporary directory that is deleted when the "
122 "bootstrap script completes."))
123parser.add_option("-t", "--accept-buildout-test-releases",
124 dest='accept_buildout_test_releases',
125 action="store_true", default=False,
126 help=("Normally, if you do not specify a --version, the "
127 "bootstrap script and buildout gets the newest "
128 "*final* versions of zc.buildout and its recipes and "
129 "extensions for you. If you use this flag, "
130 "bootstrap and buildout will get the newest releases "
131 "even if they are alphas or betas."))
132parser.add_option("-c", None, action="store", dest="config_file",
133 help=("Specify the path to the buildout configuration "
134 "file to be used."))
135
136options, args = parser.parse_args()
137
138# if -c was provided, we push it back into args for buildout's main function
139if options.config_file is not None:
140 args += ['-c', options.config_file]
141
142if options.eggs:
143 eggs_dir = os.path.abspath(os.path.expanduser(options.eggs))
144else:
145 eggs_dir = tempfile.mkdtemp()
146
147if options.setup_source is None:
148 if options.use_distribute:
149 options.setup_source = distribute_source
150 else:
151 options.setup_source = setuptools_source
152
153if options.accept_buildout_test_releases:
154 args.append('buildout:accept-buildout-test-releases=true')
155args.append('bootstrap')
156
157try:
158 import pkg_resources
159 import setuptools # A flag. Sometimes pkg_resources is installed alone.
160 if not hasattr(pkg_resources, '_distribute'):
161 raise ImportError
162except ImportError:
163 ez_code = urllib2.urlopen(
164 options.setup_source).read().replace('\r\n', '\n')
165 ez = {}
166 exec ez_code in ez
167 setup_args = dict(to_dir=eggs_dir, download_delay=0)
168 if options.download_base:
169 setup_args['download_base'] = options.download_base
170 if options.use_distribute:
171 setup_args['no_fake'] = True
172 ez['use_setuptools'](**setup_args)
173 if 'pkg_resources' in sys.modules:
174 reload(sys.modules['pkg_resources'])
175 import pkg_resources
176 # This does not (always?) update the default working set. We will
177 # do it.
178 for path in sys.path:
179 if path not in pkg_resources.working_set.entries:
180 pkg_resources.working_set.add_entry(path)
181
182cmd = [quote(sys.executable),
183 '-c',
184 quote('from setuptools.command.easy_install import main; main()'),
185 '-mqNxd',
186 quote(eggs_dir)]
187
188if not has_broken_dash_S:
189 cmd.insert(1, '-S')
190
191find_links = options.download_base
192if not find_links:
193 find_links = os.environ.get('bootstrap-testing-find-links')
194if find_links:
195 cmd.extend(['-f', quote(find_links)])
196
197if options.use_distribute:
198 setup_requirement = 'distribute'
199else:
200 setup_requirement = 'setuptools'
201ws = pkg_resources.working_set
202setup_requirement_path = ws.find(
203 pkg_resources.Requirement.parse(setup_requirement)).location
204env = dict(
205 os.environ,
206 PYTHONPATH=setup_requirement_path)
207
208requirement = 'zc.buildout'
209version = options.version
210if version is None and not options.accept_buildout_test_releases:
211 # Figure out the most recent final version of zc.buildout.
212 import setuptools.package_index
213 _final_parts = '*final-', '*final'
214 def _final_version(parsed_version):
215 for part in parsed_version:
216 if (part[:1] == '*') and (part not in _final_parts):
217 return False
218 return True
219 index = setuptools.package_index.PackageIndex(
220 search_path=[setup_requirement_path])
221 if find_links:
222 index.add_find_links((find_links,))
223 req = pkg_resources.Requirement.parse(requirement)
224 if index.obtain(req) is not None:
225 best = []
226 bestv = None
227 for dist in index[req.project_name]:
228 distv = dist.parsed_version
229 if _final_version(distv):
230 if bestv is None or distv > bestv:
231 best = [dist]
232 bestv = distv
233 elif distv == bestv:
234 best.append(dist)
235 if best:
236 best.sort()
237 version = best[-1].version
238if version:
239 requirement = '=='.join((requirement, version))
240cmd.append(requirement)
241
242if is_jython:
243 import subprocess
244 exitcode = subprocess.Popen(cmd, env=env).wait()
245else: # Windows prefers this, apparently; otherwise we would prefer subprocess
246 exitcode = os.spawnle(*([os.P_WAIT, sys.executable] + cmd + [env]))
247if exitcode != 0:
248 sys.stdout.flush()
249 sys.stderr.flush()
250 print ("An error occurred when trying to install zc.buildout. "
251 "Look above this message for any errors that "
252 "were output by easy_install.")
253 sys.exit(exitcode)
254
255ws.add_entry(eggs_dir)
256ws.require(requirement)
257import zc.buildout.buildout
258zc.buildout.buildout.main(args)
259if not options.eggs: # clean up temporary egg directory
260 shutil.rmtree(eggs_dir)
2610
=== removed file 'buildout.cfg'
--- buildout.cfg 2011-01-18 06:02:42 +0000
+++ buildout.cfg 1970-01-01 00:00:00 +0000
@@ -1,19 +0,0 @@
1[buildout]
2parts = python django
3develop = .
4eggs = django-nova
5
6[python]
7recipe = zc.recipe.egg
8interpreter = python
9eggs = ${buildout:eggs}
10
11[django]
12recipe = djangorecipe
13version = 1.2.4
14project = django_nova
15projectegg = django_nova
16settings = testsettings
17test = django_nova
18eggs = ${buildout:eggs}
19
200
=== removed file 'setup.py'
--- setup.py 2011-01-21 22:38:42 +0000
+++ setup.py 1970-01-01 00:00:00 +0000
@@ -1,29 +0,0 @@
1import os
2from setuptools import setup, find_packages
3
4def read(fname):
5 return open(os.path.join(os.path.dirname(__file__), fname)).read()
6
7setup(
8 name = "django-nova",
9 version = "0.1",
10 url = 'https://launchpad.net/django-nova/',
11 license = 'Apache 2.0',
12 description = "A Django interface for OpenStack Nova.",
13 long_description = read('README'),
14 author = 'Devin Carlen',
15 author_email = 'devin.carlen@gmail.com',
16 packages = find_packages('src'),
17 package_dir = {'': 'src'},
18 install_requires = ['setuptools', 'boto==1.9b', 'mox>=0.5.0'],
19 classifiers = [
20 'Development Status :: 4 - Beta',
21 'Framework :: Django',
22 'Intended Audience :: Developers',
23 'License :: OSI Approved :: Apache License',
24 'Operating System :: OS Independent',
25 'Programming Language :: Python',
26 'Topic :: Internet :: WWW/HTTP',
27 ]
28)
29
300
=== removed directory 'src'
=== removed directory 'src/django_nova'
=== removed file 'src/django_nova/__init__.py'
=== removed file 'src/django_nova/adminclient.py'
--- src/django_nova/adminclient.py 2011-01-28 20:35:31 +0000
+++ src/django_nova/adminclient.py 1970-01-01 00:00:00 +0000
@@ -1,498 +0,0 @@
1# vim: tabstop=4 shiftwidth=4 softtabstop=4
2
3# Copyright 2010 United States Government as represented by the
4# Administrator of the National Aeronautics and Space Administration.
5# All Rights Reserved.
6#
7# Licensed under the Apache License, Version 2.0 (the "License"); you may
8# not use this file except in compliance with the License. You may obtain
9# a copy of the License at
10#
11# http://www.apache.org/licenses/LICENSE-2.0
12#
13# Unless required by applicable law or agreed to in writing, software
14# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16# License for the specific language governing permissions and limitations
17# under the License.
18"""
19Nova User API client library.
20"""
21
22import base64
23import boto
24import boto.exception
25import httplib
26import re
27import string
28from boto.ec2.regioninfo import RegionInfo
29
30
31DEFAULT_CLC_URL='http://127.0.0.1:8773'
32DEFAULT_REGION='nova'
33DEFAULT_ACCESS_KEY='admin'
34DEFAULT_SECRET_KEY='admin'
35
36
37class UserInfo(object):
38 """
39 Information about a Nova user, as parsed through SAX
40 fields include:
41 username
42 accesskey
43 secretkey
44
45 and an optional field containing a zip with X509 cert & rc
46 file
47 """
48
49 def __init__(self, connection=None, username=None, endpoint=None):
50 self.connection = connection
51 self.username = username
52 self.endpoint = endpoint
53
54 def __repr__(self):
55 return 'UserInfo:%s' % self.username
56
57 def startElement(self, name, attrs, connection):
58 return None
59
60 def endElement(self, name, value, connection):
61 if name == 'username':
62 self.username = str(value)
63 elif name == 'file':
64 self.file = base64.b64decode(str(value))
65 elif name == 'accesskey':
66 self.accesskey = str(value)
67 elif name == 'secretkey':
68 self.secretkey = str(value)
69
70
71class UserRole(object):
72 """
73 Information about a Nova user's role, as parsed through SAX.
74 Fields include:
75 role
76 """
77 def __init__(self, connection=None):
78 self.connection = connection
79 self.role = None
80
81 def __repr__(self):
82 return 'UserRole:%s' % self.role
83
84 def startElement(self, name, attrs, connection):
85 return None
86
87 def endElement(self, name, value, connection):
88 if name == 'role':
89 self.role = value
90 else:
91 setattr(self, name, str(value))
92
93
94class ProjectInfo(object):
95 """
96 Information about a Nova project, as parsed through SAX
97 Fields include:
98 projectname
99 description
100 projectManagerId
101 memberIds
102 """
103
104 def __init__(self, connection=None):
105 self.connection = connection
106 self.projectname = None
107 self.description = None
108 self.projectManagerId = None
109 self.memberIds = []
110
111 def __repr__(self):
112 return 'ProjectInfo:%s' % self.projectname
113
114 def startElement(self, name, attrs, connection):
115 return None
116
117 def endElement(self, name, value, connection):
118 if name == 'projectname':
119 self.projectname = value
120 elif name == 'description':
121 self.description = value
122 elif name == 'projectManagerId':
123 self.projectManagerId = value
124 elif name == 'memberId':
125 self.memberIds.append(value)
126 else:
127 setattr(self, name, str(value))
128
129
130class ProjectMember(object):
131 """
132 Information about a Nova project member, as parsed through SAX.
133 Fields include:
134 memberId
135 """
136
137 def __init__(self, connection=None):
138 self.connection = connection
139 self.memberId = None
140
141 def __repr__(self):
142 return 'ProjectMember:%s' % self.memberId
143
144 def startElement(self, name, attrs, connection):
145 return None
146
147 def endElement(self, name, value, connection):
148 if name == 'member':
149 self.memberId = value
150 else:
151 setattr(self, name, str(value))
152
153
154class HostInfo(object):
155 """
156 Information about a Nova Host, as parsed through SAX:
157 Hostname
158 Compute Service Status
159 Volume Service Status
160 """
161
162 def __init__(self, connection=None):
163 self.connection = connection
164 self.hostname = None
165 self.compute = None
166 self.volume = None
167 self.instance_count = 0
168 self.volume_count = 0
169
170 def __repr__(self):
171 return 'Host:%s' % self.hostname
172
173 # this is needed by the sax parser, so ignore the ugly name
174 def startElement(self, name, attrs, connection):
175 return None
176
177 # this is needed by the sax parser, so ignore the ugly name
178 def endElement(self, name, value, connection):
179 fixed_name = string.lower(re.sub(r'([A-Z])', r'_\1', name))
180 setattr(self, fixed_name, value)
181
182
183class Vpn(object):
184 """
185 Information about a Vpn, as parsed through SAX
186 fields include:
187 instance_id
188 project_id
189 public_ip
190 public_port
191 created_at
192 internal_ip
193 state
194 """
195
196 def __init__(self, connection=None):
197 self.connection = connection
198 self.instance_id = None
199 self.project_id = None
200
201 def __repr__(self):
202 return 'Vpn:%s:%s' % (self.project_id, self.instance_id)
203
204 def startElement(self, name, attrs, connection):
205 return None
206
207 def endElement(self, name, value, connection):
208 if name == 'instanceId':
209 self.instance_id = str(value)
210 elif name == 'projectId':
211 self.project_id = str(value)
212 elif name == 'publicIp':
213 self.public_ip = str(value)
214 elif name == 'publicPort':
215 self.public_port = str(value)
216 elif name == 'createdAt':
217 self.created_at = str(value)
218 elif name == 'internalIp':
219 self.internal_ip = str(value)
220 else:
221 setattr(self, name, str(value))
222
223
224class InstanceType(object):
225 """
226 Information about a Nova instance type, as parsed through SAX.
227
228 **Fields include**
229
230 * name
231 * vcpus
232 * disk_gb
233 * memory_mb
234 * flavor_id
235
236 """
237
238 def __init__(self, connection=None):
239 self.connection = connection
240 self.name = None
241 self.vcpus = None
242 self.disk_gb = None
243 self.memory_mb = None
244 self.flavor_id = None
245
246 def __repr__(self):
247 return 'InstanceType:%s' % self.name
248
249 def startElement(self, name, attrs, connection):
250 return None
251
252 def endElement(self, name, value, connection):
253 if name == "memoryMb":
254 self.memory_mb = str(value)
255 elif name == "flavorId":
256 self.flavor_id = str(value)
257 elif name == "diskGb":
258 self.disk_gb = str(value)
259 else:
260 setattr(self, name, str(value))
261
262
263class StatusResponse(object):
264 def __init__(self, connection=None):
265 self.connection = connection
266 self.status = None
267
268 def __repr__(self):
269 return 'Status:%s' % self.status
270
271 def startElement(self, name, attrs, connection):
272 return None
273
274 def endElement(self, name, value, connection):
275 setattr(self, name, str(value))
276
277
278class NovaAdminClient(object):
279 def __init__(self, clc_url=DEFAULT_CLC_URL, region=DEFAULT_REGION,
280 access_key=DEFAULT_ACCESS_KEY, secret_key=DEFAULT_SECRET_KEY,
281 **kwargs):
282 parts = self.split_clc_url(clc_url)
283
284 self.clc_url = clc_url
285 self.region = region
286 self.access = access_key
287 self.secret = secret_key
288 self.apiconn = boto.connect_ec2(aws_access_key_id=access_key,
289 aws_secret_access_key=secret_key,
290 is_secure=parts['is_secure'],
291 region=RegionInfo(None,
292 region,
293 parts['ip']),
294 port=parts['port'],
295 path='/services/Admin',
296 **kwargs)
297 self.apiconn.APIVersion = 'nova'
298
299 def connection_for(self, username, project, clc_url=None, region=None,
300 **kwargs):
301 """
302 Returns a boto ec2 connection for the given username.
303 """
304 if not clc_url:
305 clc_url = self.clc_url
306 if not region:
307 region = self.region
308 parts = self.split_clc_url(clc_url)
309 user = self.get_user(username)
310 access_key = '%s:%s' % (user.accesskey, project)
311 return boto.connect_ec2(aws_access_key_id=access_key,
312 aws_secret_access_key=user.secretkey,
313 is_secure=parts['is_secure'],
314 region=RegionInfo(None,
315 self.region,
316 parts['ip']),
317 port=parts['port'],
318 path='/services/Cloud',
319 **kwargs)
320
321 def split_clc_url(self, clc_url):
322 """
323 Splits a cloud controller endpoint url.
324 """
325 parts = httplib.urlsplit(clc_url)
326 is_secure = parts.scheme == 'https'
327 ip, port = parts.netloc.split(':')
328 return {'ip': ip, 'port': int(port), 'is_secure': is_secure}
329
330 def get_users(self):
331 """ grabs the list of all users """
332 return self.apiconn.get_list('DescribeUsers', {}, [('item', UserInfo)])
333
334 def get_user(self, name):
335 """ grab a single user by name """
336 try:
337 return self.apiconn.get_object('DescribeUser', {'Name': name}, UserInfo)
338 except boto.exception.BotoServerError, e:
339 if e.status == 400 and e.error_code == 'NotFound':
340 return None
341 raise
342
343 def has_user(self, username):
344 """ determine if user exists """
345 return self.get_user(username) != None
346
347 def create_user(self, username):
348 """ creates a new user, returning the userinfo object with access/secret """
349 return self.apiconn.get_object('RegisterUser', {'Name': username}, UserInfo)
350
351 def delete_user(self, username):
352 """ deletes a user """
353 return self.apiconn.get_object('DeregisterUser', {'Name': username}, UserInfo)
354
355 def get_roles(self, project_roles=True):
356 """Returns a list of available roles."""
357 return self.apiconn.get_list('DescribeRoles',
358 {'ProjectRoles': project_roles},
359 [('item', UserRole)])
360
361 def get_user_roles(self, user, project=None):
362 """Returns a list of roles for the given user.
363 Omitting project will return any global roles that the user has.
364 Specifying project will return only project specific roles.
365 """
366 params = {'User':user}
367 if project:
368 params['Project'] = project
369 return self.apiconn.get_list('DescribeUserRoles',
370 params,
371 [('item', UserRole)])
372
373 def add_user_role(self, user, role, project=None):
374 """
375 Add a role to a user either globally or for a specific project.
376 """
377 return self.modify_user_role(user, role, project=project,
378 operation='add')
379
380 def remove_user_role(self, user, role, project=None):
381 """
382 Remove a role from a user either globally or for a specific project.
383 """
384 return self.modify_user_role(user, role, project=project,
385 operation='remove')
386
387 def modify_user_role(self, user, role, project=None, operation='add',
388 **kwargs):
389 """
390 Add or remove a role for a user and project.
391 """
392 params = {'User': user,
393 'Role': role,
394 'Project': project,
395 'Operation': operation}
396 return self.apiconn.get_status('ModifyUserRole', params)
397
398 def get_projects(self, user=None):
399 """
400 Returns a list of all projects.
401 """
402 if user:
403 params = {'User': user}
404 else:
405 params = {}
406 return self.apiconn.get_list('DescribeProjects',
407 params,
408 [('item', ProjectInfo)])
409
410 def get_project(self, name):
411 """
412 Returns a single project with the specified name.
413 """
414 project = self.apiconn.get_object('DescribeProject',
415 {'Name': name},
416 ProjectInfo)
417
418 if project.projectname != None:
419 return project
420
421 def create_project(self, projectname, manager_user, description=None,
422 member_users=None):
423 """
424 Creates a new project.
425 """
426 params = {'Name': projectname,
427 'ManagerUser': manager_user,
428 'Description': description,
429 'MemberUsers': member_users}
430 return self.apiconn.get_object('RegisterProject', params, ProjectInfo)
431
432 def delete_project(self, projectname):
433 """
434 Permanently deletes the specified project.
435 """
436 return self.apiconn.get_object('DeregisterProject',
437 {'Name': projectname},
438 ProjectInfo)
439
440 def get_project_members(self, name):
441 """
442 Returns a list of members of a project.
443 """
444 return self.apiconn.get_list('DescribeProjectMembers',
445 {'Name': name},
446 [('item', ProjectMember)])
447
448 def add_project_member(self, user, project):
449 """
450 Adds a user to a project.
451 """
452 return self.modify_project_member(user, project, operation='add')
453
454 def remove_project_member(self, user, project):
455 """
456 Removes a user from a project.
457 """
458 return self.modify_project_member(user, project, operation='remove')
459
460 def modify_project_member(self, user, project, operation='add'):
461 """
462 Adds or removes a user from a project.
463 """
464 params = {'User': user,
465 'Project': project,
466 'Operation': operation}
467 return self.apiconn.get_status('ModifyProjectMember', params)
468
469 def get_zip(self, user, project):
470 """
471 Returns the content of a zip file containing novarc and access credentials.
472 """
473 params = {'Name': user, 'Project': project}
474 zip = self.apiconn.get_object('GenerateX509ForUser', params, UserInfo)
475 return zip.file
476
477 def start_vpn(self, project):
478 """
479 Starts the vpn for a user
480 """
481 return self.apiconn.get_object('StartVpn', {'Project': project}, Vpn)
482
483 def get_vpns(self):
484 """Return a list of vpn with project name"""
485 return self.apiconn.get_list('DescribeVpns', {}, [('item', Vpn)])
486
487 def get_hosts(self):
488 return self.apiconn.get_list('DescribeHosts', {}, [('item', HostInfo)])
489
490 def get_instance_types(self):
491 """Grabs the list of all users."""
492 return self.apiconn.get_list('DescribeInstanceTypes', {},
493 [('item', InstanceType)])
494
495 def disable_project_credentials(self, project):
496 """Revoke project credentials and kill the cloudpipe/vpn instance"""
497 return self.apiconn.get_object('DisableProjectCredentials',
498 {'Project': project}, StatusResponse)
4990
=== removed file 'src/django_nova/connection.py'
--- src/django_nova/connection.py 2011-01-12 20:02:06 +0000
+++ src/django_nova/connection.py 1970-01-01 00:00:00 +0000
@@ -1,38 +0,0 @@
1# vim: tabstop=4 shiftwidth=4 softtabstop=4
2
3# Copyright 2010 United States Government as represented by the
4# Administrator of the National Aeronautics and Space Administration.
5# All Rights Reserved.
6#
7# Licensed under the Apache License, Version 2.0 (the "License"); you may
8# not use this file except in compliance with the License. You may obtain
9# a copy of the License at
10#
11# http://www.apache.org/licenses/LICENSE-2.0
12#
13# Unless required by applicable law or agreed to in writing, software
14# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16# License for the specific language governing permissions and limitations
17# under the License.
18"""
19Manage connections to Nova's admin API.
20"""
21
22from django.conf import settings
23from django_nova import adminclient
24
25
26def get_nova_admin_connection():
27 """
28 Returns a Nova administration connection.
29 """
30 return adminclient.NovaAdminClient (
31 clc_url=settings.NOVA_DEFAULT_ENDPOINT,
32 region=settings.NOVA_DEFAULT_REGION,
33 access_key=settings.NOVA_ACCESS_KEY,
34 secret_key=settings.NOVA_SECRET_KEY
35 )
36
37
38
390
=== removed file 'src/django_nova/exceptions.py'
--- src/django_nova/exceptions.py 2011-01-18 23:07:26 +0000
+++ src/django_nova/exceptions.py 1970-01-01 00:00:00 +0000
@@ -1,95 +0,0 @@
1# vim: tabstop=4 shiftwidth=4 softtabstop=4
2
3# Copyright 2010 United States Government as represented by the
4# Administrator of the National Aeronautics and Space Administration.
5# All Rights Reserved.
6#
7# Licensed under the Apache License, Version 2.0 (the "License"); you may
8# not use this file except in compliance with the License. You may obtain
9# a copy of the License at
10#
11# http://www.apache.org/licenses/LICENSE-2.0
12#
13# Unless required by applicable law or agreed to in writing, software
14# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16# License for the specific language governing permissions and limitations
17# under the License.
18
19"""
20Better wrappers for errors from Nova's admin api.
21"""
22
23import boto.exception
24from django.shortcuts import redirect
25from django.core import exceptions as core_exceptions
26
27
28class NovaServerError(Exception):
29 """
30 Consumes a BotoServerError and gives more meaningful errors.
31 """
32 def __init__(self, ec2error):
33 self.status = ec2error.status
34 self.message = ec2error.reason
35
36 def __str__(self):
37 return self.message
38
39
40class NovaApiError(Exception):
41 """
42 Used when Nova returns a 400 Bad Request status.
43 """
44 def __init__(self, ec2error):
45 self.message = ec2error.error_message
46
47 def __str__(self):
48 return self.message
49
50
51class NovaUnavailableError(NovaServerError):
52 """
53 Used when Nova returns a 503 Service Unavailable status.
54 """
55 pass
56
57
58class NovaUnauthorizedError(core_exceptions.PermissionDenied):
59 """
60 Used when Nova returns a 401 Not Authorized status.
61 """
62 pass
63
64
65def wrap_nova_error(func):
66 """
67 Used to decorate a function that interacts with boto. It will catch
68 and convert boto server errors and reraise as a more specific nova error.
69 """
70 def decorator(*args, **kwargs):
71 try:
72 return func(*args, **kwargs)
73 except boto.exception.BotoServerError, e:
74 if e.status == 400 and e.error_code == 'ApiError':
75 raise NovaApiError(e)
76 elif e.status == 401:
77 raise NovaUnauthorizedError()
78 elif e.status == 503:
79 raise NovaUnavailableError(e)
80 raise NovaServerError(e)
81 return decorator
82
83
84def handle_nova_error(func):
85 """
86 Decorator for handling nova errors in a generalized way.
87 """
88 def decorator(*args, **kwargs):
89 try:
90 return func(*args, **kwargs)
91 except NovaUnavailableError:
92 return redirect('nova_unavailable')
93 return decorator
94
95
960
=== removed file 'src/django_nova/forms.py'
--- src/django_nova/forms.py 2011-01-21 22:38:42 +0000
+++ src/django_nova/forms.py 1970-01-01 00:00:00 +0000
@@ -1,262 +0,0 @@
1# vim: tabstop=4 shiftwidth=4 softtabstop=4
2
3# Copyright 2010 United States Government as represented by the
4# Administrator of the National Aeronautics and Space Administration.
5# All Rights Reserved.
6#
7# Licensed under the Apache License, Version 2.0 (the "License"); you may
8# not use this file except in compliance with the License. You may obtain
9# a copy of the License at
10#
11# http://www.apache.org/licenses/LICENSE-2.0
12#
13# Unless required by applicable law or agreed to in writing, software
14# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16# License for the specific language governing permissions and limitations
17# under the License.
18
19"""
20Forms used by various views.
21"""
22
23import re
24
25from django import forms
26from django.contrib.auth import models as auth_models
27from django_nova.connection import get_nova_admin_connection
28from django_nova.exceptions import wrap_nova_error
29
30
31# TODO: Store this in settings.
32MAX_VOLUME_SIZE = 100
33
34alphanumeric_re = re.compile(r'^\w+$')
35
36
37@wrap_nova_error
38def get_instance_type_choices():
39 """
40 Returns list of instance types from nova admin api
41 """
42 nova = get_nova_admin_connection()
43 instance_types = nova.get_instance_types()
44 rv = []
45 for t in instance_types:
46 rv.append((t.name, "%s (%sMB memory, %s cpu, %sGB space)" % \
47 (t.name, t.memory_mb, t.vcpus, t.disk_gb)))
48 return rv
49
50def get_instance_choices(project):
51 choices = [(i.id, i.id) for i in project.get_instances()]
52 if not len(choices):
53 choices = [('', 'none available')]
54 return choices
55
56def get_key_pair_choices(project):
57 choices = [(k.name, k.name) for k in project.get_key_pairs()]
58 if not len(choices):
59 choices = [('', 'none available')]
60 return choices
61
62#def get_security_group_choices(project):
63# choices = [(g.name, g.description) for g in project.get_security_groups()]
64# if len(choices) == 0:
65# choices = [('', 'none available')]
66# return choices
67
68def get_available_volume_choices(project):
69 choices = [(v.id, '%s %s - %dGB' % (v.id, v.displayName, v.size)) for v in \
70 project.get_volumes() if v.status != "in-use"]
71 if not len(choices):
72 choices = [('', 'none available')]
73 return choices
74
75def get_protocols():
76 return (
77 ('tcp', 'tcp'),
78 ('udp', 'udp'),
79 )
80
81@wrap_nova_error
82def get_roles(project_roles=True):
83 nova = get_nova_admin_connection()
84 roles = nova.get_roles(project_roles=project_roles)
85 return [(role.role, role.role) for role in roles]
86
87@wrap_nova_error
88def get_members(project):
89 nova = get_nova_admin_connection()
90 members = nova.get_project_members(project)
91 return [str(user.memberId) for user in members]
92
93@wrap_nova_error
94def set_project_roles(projectname, username, roles):
95 nova = get_nova_admin_connection()
96 # hacky work around to interface correctly with multiple select form
97 _remove_roles(projectname, username)
98
99 for role in roles:
100 nova.add_user_role(username, str(role), projectname)
101
102def _remove_roles(project, username):
103 nova = get_nova_admin_connection()
104 userroles = nova.get_user_roles(username, project)
105 roles = [str(role.role) for role in userroles]
106
107 for role in roles:
108 if role == "developer":
109 nova.remove_user_role(username, "developer", project)
110 if role == "sysadmin":
111 nova.remove_user_role(username, "sysadmin", project)
112 if role == "netadmin":
113 nova.remove_user_role(username, "netadmin", project)
114
115
116class ProjectFormBase(forms.Form):
117 def __init__(self, project, *args, **kwargs):
118 self.project = project
119 super(ProjectFormBase, self).__init__(*args, **kwargs)
120
121
122class LaunchInstanceForm(forms.Form):
123 # nickname = forms.CharField()
124 # description = forms.CharField()
125
126 count = forms.ChoiceField(choices=[(x, x) for x in range(1, 6)])
127 size = forms.ChoiceField()
128 key_name = forms.ChoiceField()
129 #security_group = forms.ChoiceField()
130 user_data = forms.CharField(required=False, widget=forms.widgets.Textarea(attrs={'rows': 4}))
131
132 def __init__(self, project, *args, **kwargs):
133 forms.Form.__init__(self, *args, **kwargs)
134 #self.fields['security_group'].choices = get_security_group_choices(project)
135 self.fields['key_name'].choices = get_key_pair_choices(project)
136 self.fields['size'].choices = get_instance_type_choices()
137
138
139class UpdateInstanceForm(forms.Form):
140 nickname = forms.CharField(required=False, label="Name")
141 description = forms.CharField(required=False, widget=forms.Textarea, max_length=70)
142
143 def __init__(self, instance, *args, **kwargs):
144 forms.Form.__init__(self, *args, **kwargs)
145 self.fields['nickname'].initial = instance.displayName
146 self.fields['description'].initial = instance.displayDescription
147
148
149class UpdateImageForm(forms.Form):
150 nickname = forms.CharField(required=False, label="Name")
151 description = forms.CharField(required=False, widget=forms.Textarea, max_length=70)
152
153 def __init__(self, image, *args, **kwargs):
154 forms.Form.__init__(self, *args, **kwargs)
155 self.fields['nickname'].initial = image.displayName
156 self.fields['description'].initial = image.description
157
158
159class CreateKeyPairForm(ProjectFormBase):
160 name = forms.RegexField(regex=alphanumeric_re)
161
162 def clean_name(self):
163 name = self.cleaned_data['name']
164
165 if self.project.has_key_pair(name):
166 raise forms.ValidationError('A key named %s already exists.' % name)
167
168 return name
169
170
171class CreateSecurityGroupForm(ProjectFormBase):
172 name = forms.RegexField(regex=alphanumeric_re)
173 description = forms.CharField()
174
175 def clean_name(self):
176 name = self.cleaned_data['name']
177
178 if self.project.has_security_group(name):
179 raise forms.ValidationError('A security group named %s already exists.' % name)
180
181 return name
182
183
184class AuthorizeSecurityGroupRuleForm(forms.Form):
185 protocol = forms.ChoiceField(choices=get_protocols())
186 from_port = forms.IntegerField(min_value=1, max_value=65535)
187 to_port = forms.IntegerField(min_value=1, max_value=65535)
188
189
190class CreateVolumeForm(forms.Form):
191 size = forms.IntegerField(label='Size (in GB)', min_value=1, max_value=MAX_VOLUME_SIZE)
192 nickname = forms.CharField()
193 description = forms.CharField()
194
195
196class AttachVolumeForm(ProjectFormBase):
197 volume = forms.ChoiceField()
198 instance = forms.ChoiceField()
199 device = forms.CharField(initial='/dev/vdb')
200
201 def __init__(self, project, *args, **kwargs):
202 super(AttachVolumeForm, self).__init__(project, *args, **kwargs)
203 self.fields['volume'].choices = get_available_volume_choices(project)
204 self.fields['instance'].choices = get_instance_choices(project)
205
206
207class ProjectForm(forms.Form):
208 projectname = forms.CharField(label="Project Name", max_length=20)
209 description = forms.CharField(label="Description",
210 widget=forms.widgets.Textarea())
211 manager = forms.ModelChoiceField(queryset=auth_models.User.objects.all(),
212 label="Project Manager")
213
214
215class GlobalRolesForm(forms.Form):
216 role = forms.MultipleChoiceField(label='Roles', required=False)
217
218 def __init__(self, *args, **kwargs):
219 super(GlobalRolesForm, self).__init__(*args, **kwargs)
220 self.fields['role'].choices = get_roles(project_roles=False)
221
222
223class ProjectUserForm(forms.Form):
224 role = forms.MultipleChoiceField(label='Roles', required=False)
225
226 def __init__(self, project, user, *args, **kwargs):
227 super(ProjectUserForm, self).__init__(*args, **kwargs)
228 self.project = project
229 self.user = user
230 self.fields['role'].choices = get_roles()
231
232 def save(self):
233 set_project_roles(self.project.projectname,
234 self.user.username,
235 self.cleaned_data['role'])
236
237
238class AddProjectUserForm(forms.Form):
239 username = forms.ModelChoiceField(queryset='',
240 label='Username',
241 empty_label='Select a Username')
242 role = forms.MultipleChoiceField(label='Roles')
243
244 def __init__(self, *args, **kwargs):
245 project = kwargs.pop('project')
246 super(AddProjectUserForm, self).__init__(*args, **kwargs)
247 members = get_members(project)
248
249 self.fields['username'].queryset = \
250 auth_models.User.objects.exclude(username__in=members)
251 self.fields['role'].choices = get_roles()
252
253
254class SendCredentialsForm(forms.Form):
255 users = forms.MultipleChoiceField(label='Users', required=True)
256
257 def __init__(self, *args, **kwargs):
258 query_list = kwargs.pop('query_list')
259 super(SendCredentialsForm, self).__init__(*args, **kwargs)
260
261 self.fields['users'].choices = [(choices, choices) for choices in query_list]
262
2630
=== removed directory 'src/django_nova/management'
=== removed file 'src/django_nova/management/__init__.py'
=== removed directory 'src/django_nova/management/commands'
=== removed file 'src/django_nova/management/commands/__init__.py'
=== removed file 'src/django_nova/management/commands/createnovausers.py'
--- src/django_nova/management/commands/createnovausers.py 2011-01-12 20:02:06 +0000
+++ src/django_nova/management/commands/createnovausers.py 1970-01-01 00:00:00 +0000
@@ -1,37 +0,0 @@
1# vim: tabstop=4 shiftwidth=4 softtabstop=4
2
3# Copyright 2010 United States Government as represented by the
4# Administrator of the National Aeronautics and Space Administration.
5# All Rights Reserved.
6#
7# Licensed under the Apache License, Version 2.0 (the "License"); you may
8# not use this file except in compliance with the License. You may obtain
9# a copy of the License at
10#
11# http://www.apache.org/licenses/LICENSE-2.0
12#
13# Unless required by applicable law or agreed to in writing, software
14# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16# License for the specific language governing permissions and limitations
17# under the License.
18"""
19Management commands for synchronizing the Django auth database and Nova
20users database.
21"""
22
23from django.core.management.base import NoArgsCommand
24from django.contrib.auth.models import User
25from django_nova.connection import get_nova_admin_connection
26
27class Command(NoArgsCommand):
28 help = 'Creates nova users for all users in the django auth database.'
29
30 def handle_noargs(self, **options):
31 nova = get_nova_admin_connection()
32 users = User.objects.all()
33 for user in users:
34 if not nova.has_user(user.username):
35 self.stdout.write('creating user %s... ' % user.username)
36 nova.create_user(user.username)
37 self.stdout.write('ok\n')
380
=== removed file 'src/django_nova/manager.py'
--- src/django_nova/manager.py 2011-01-24 00:02:34 +0000
+++ src/django_nova/manager.py 1970-01-01 00:00:00 +0000
@@ -1,340 +0,0 @@
1# vim: tabstop=4 shiftwidth=4 softtabstop=4
2
3# Copyright 2010 United States Government as represented by the
4# Administrator of the National Aeronautics and Space Administration.
5# All Rights Reserved.
6#
7# Licensed under the Apache License, Version 2.0 (the "License"); you may
8# not use this file except in compliance with the License. You may obtain
9# a copy of the License at
10#
11# http://www.apache.org/licenses/LICENSE-2.0
12#
13# Unless required by applicable law or agreed to in writing, software
14# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16# License for the specific language governing permissions and limitations
17# under the License.
18"""
19Simple API for interacting with Nova projects.
20"""
21
22import boto
23import boto.ec2.volume
24import boto.exception
25import boto.s3
26from django.conf import settings
27from django_nova.connection import get_nova_admin_connection
28from django_nova.exceptions import wrap_nova_error
29
30
31class ProjectManager(object):
32 def __init__(self, username, project, region):
33 self.username = username
34 self.projectname = project.projectname
35 self.projectManagerId = project.projectManagerId
36 self.region = region
37
38 def get_nova_connection(self):
39 """
40 Returns a boto connection for a user's project.
41 """
42 nova = get_nova_admin_connection()
43 return nova.connection_for(self.username,
44 self.projectname,
45 clc_url=self.region['endpoint'],
46 region=self.region['name'])
47
48 def get_zip(self):
49 """
50 Returns a buffer of a zip file containing signed credentials
51 for the project's Nova user.
52 """
53 nova = get_nova_admin_connection()
54 return nova.get_zip(self.username, self.projectname)
55
56 def get_images(self, image_ids=None):
57 conn = self.get_nova_connection()
58 images = conn.get_all_images(image_ids=image_ids)
59 sorted_images = [i for i in images if i.ownerId == self.username] + \
60 [i for i in images if i.ownerId != self.username]
61
62 return [i for i in sorted_images if i.type == 'machine' and i.location.split('/')[0] != 'nova']
63
64 def get_image(self, image_id):
65 try:
66 return self.get_images(image_ids=[image_id,])[0]
67 except IndexError:
68 return None
69
70 @wrap_nova_error
71 def deregister_image(self, image_id):
72 """
73 Removes the image's listing but leaves the image
74 and manifest in the object store in tact.
75 """
76 conn = self.get_nova_connection()
77 return conn.deregister_image(image_id)
78
79 @wrap_nova_error
80 def update_image(self, image_id, display_name=None, description=None):
81 conn = self.get_nova_connection()
82 params = {
83 'ImageId': image_id,
84 'DisplayName': display_name,
85 'Description': description
86 }
87 return conn.get_object('UpdateImage', params, boto.ec2.image.Image)
88
89 @wrap_nova_error
90 def modify_image_attribute(self, image_id, attribute=None, operation=None,
91 groups='all'):
92 conn = self.get_nova_connection()
93 return conn.modify_image_attribute(image_id,
94 attribute='launchPermission',
95 operation='remove',
96 groups='all',)
97
98
99 @wrap_nova_error
100 def run_instances(self, image_id, **kwargs):
101 """
102 Runs instances of the specified image id.
103 """
104 conn = self.get_nova_connection()
105 return conn.run_instances(image_id, **kwargs)
106
107 def get_instance_count(self):
108 """
109 Returns the number of active instances in this project or None if unknown.
110 """
111 try:
112 return len(self.get_instances())
113 except:
114 return None
115
116 @wrap_nova_error
117 def get_instances(self):
118 """
119 Returns all instances in this project.
120 """
121 conn = self.get_nova_connection()
122 reservations = conn.get_all_instances()
123 instances = []
124 for reservation in reservations:
125 for instance in reservation.instances:
126 instances.append(instance)
127 return instances
128
129 @wrap_nova_error
130 def get_instance(self, instance_id):
131 """
132 Returns detail about the specified instance.
133 """
134 conn = self.get_nova_connection()
135 # TODO: Refactor this once nova's describe_instances filters by instance_id.
136 reservations = conn.get_all_instances()
137 for reservation in reservations:
138 for instance in reservation.instances:
139 if instance.id == instance_id:
140 return instance
141 return None
142
143 @wrap_nova_error
144 def update_instance(self, instance_id, updates):
145 conn = self.get_nova_connection()
146 params = {'InstanceId': instance_id, 'DisplayName': updates['nickname'],
147 'DisplayDescription': updates['description']}
148 return conn.get_object('UpdateInstance', params,
149 boto.ec2.instance.Instance)
150
151 def get_instance_graph(self, region, instance_id, graph_name):
152 # TODO(devcamcar): Need better support for multiple regions.
153 # Need a way to get object store by region.
154 s3 = boto.s3.connection.S3Connection (
155 aws_access_key_id=settings.NOVA_ACCESS_KEY,
156 aws_secret_access_key=settings.NOVA_SECRET_KEY,
157 is_secure=False,
158 calling_format=boto.s3.connection.OrdinaryCallingFormat(),
159 port=3333,
160 host=settings.NOVA_CLC_IP
161 )
162 key = '_%s.monitor' % instance_id
163
164 try:
165 bucket = s3.get_bucket(key, validate=False)
166 except boto.exception.S3ResponseError, e:
167 if e.code == "NoSuchBucket":
168 return None
169 else:
170 raise e
171
172 key = bucket.get_key(graph_name)
173
174 return key.read()
175
176 @wrap_nova_error
177 def terminate_instance(self, instance_id):
178 """ Terminates the specified instance within this project. """
179 conn = self.get_nova_connection()
180 conn.terminate_instances([instance_id])
181
182 @wrap_nova_error
183 def get_security_groups(self):
184 """
185 Returns all security groups associated with this project.
186 """
187 conn = self.get_nova_connection()
188 groups = []
189
190 for g in conn.get_all_security_groups():
191 # Do not show vpn group.
192 #if g.name != 'vpn-secgroup':
193 groups.append(g)
194
195 return groups
196
197 @wrap_nova_error
198 def get_security_group(self, name):
199 """
200 Returns the specified security group for this project.
201 """
202 conn = self.get_nova_connection()
203
204 try:
205 return conn.get_all_security_groups(groupnames=name.encode('ASCII'))[0]
206 except IndexError:
207 return None
208
209 @wrap_nova_error
210 def has_security_group(self, name):
211 """
212 Indicates whether a security group with the specified name exists in this project.
213 """
214 return self.get_security_group(name) is not None
215
216 @wrap_nova_error
217 def create_security_group(self, name, description):
218 """
219 Creates a new security group in this project.
220 """
221 conn = self.get_nova_connection()
222 return conn.create_security_group(name, description)
223
224 @wrap_nova_error
225 def delete_security_group(self, name):
226 """
227 Deletes a security group from the project.
228 """
229 conn = self.get_nova_connection()
230 return conn.delete_security_group(name = name)
231
232 @wrap_nova_error
233 def authorize_security_group(self, group_name, ip_protocol, from_port, to_port):
234 """
235 Authorizes a rule for the specified security group.
236 """
237 conn = self.get_nova_connection()
238 return conn.authorize_security_group (
239 group_name = group_name,
240 ip_protocol = ip_protocol,
241 from_port = from_port,
242 to_port = to_port,
243 cidr_ip = '0.0.0.0/0'
244 )
245
246 @wrap_nova_error
247 def revoke_security_group(self, group_name, ip_protocol, from_port, to_port):
248 """
249 Revokes a rule for the specified security group.
250 """
251 conn = self.get_nova_connection()
252 return conn.revoke_security_group (
253 group_name = group_name,
254 ip_protocol = ip_protocol,
255 from_port = from_port,
256 to_port = to_port,
257 cidr_ip = '0.0.0.0/0'
258 )
259
260 @wrap_nova_error
261 def get_key_pairs(self):
262 """
263 Returns all key pairs associated with this project.
264 """
265 conn = self.get_nova_connection()
266 keys = []
267
268 for k in conn.get_all_key_pairs():
269 # Do not show vpn key.
270 if k.name != 'vpn-key':
271 keys.append(k)
272
273 return keys
274
275 @wrap_nova_error
276 def get_key_pair(self, name):
277 """
278 Returns the specified security group for this project.
279 """
280 conn = self.get_nova_connection()
281
282 try:
283 return conn.get_all_key_pairs(keynames=name.encode('ASCII'))[0]
284 except IndexError:
285 return None
286
287 @wrap_nova_error
288 def has_key_pair(self, name):
289 """
290 Indicates whether a key pair with the specified name exists in this project.
291 """
292 return self.get_key_pair(name) != None
293
294 @wrap_nova_error
295 def create_key_pair(self, name):
296 """
297 Creates a new key pair for this project.
298 """
299 conn = self.get_nova_connection()
300 return conn.create_key_pair(name)
301
302 @wrap_nova_error
303 def delete_key_pair(self, name):
304 """
305 Deletes a new key pair from this project.
306 """
307 conn = self.get_nova_connection()
308 conn.delete_key_pair(name)
309
310 @wrap_nova_error
311 def get_volumes(self):
312 """
313 Returns all volumes in this project.
314 """
315 conn = self.get_nova_connection()
316 return conn.get_all_volumes()
317
318 @wrap_nova_error
319 def create_volume(self, size, display_name=None, display_description=None,
320 snapshot=None):
321 conn = self.get_nova_connection()
322 params = {'Size': size, 'DisplayName': display_name,
323 'DisplayDescription': display_description}
324 return conn.get_object('CreateVolume', params, boto.ec2.volume.Volume)
325
326 @wrap_nova_error
327 def delete_volume(self, volume_id):
328 conn = self.get_nova_connection()
329 return conn.delete_volume(volume_id)
330
331 @wrap_nova_error
332 def attach_volume(self, volume_id, instance_id, device):
333 conn = self.get_nova_connection()
334 return conn.attach_volume(volume_id, instance_id, device)
335
336 @wrap_nova_error
337 def detach_volume(self, volume_id):
338 conn = self.get_nova_connection()
339 return conn.detach_volume(volume_id)
340
3410
=== removed file 'src/django_nova/models.py'
--- src/django_nova/models.py 2011-01-15 11:26:01 +0000
+++ src/django_nova/models.py 1970-01-01 00:00:00 +0000
@@ -1,121 +0,0 @@
1# vim: tabstop=4 shiftwidth=4 softtabstop=4
2
3# Copyright 2010 United States Government as represented by the
4# Administrator of the National Aeronautics and Space Administration.
5# All Rights Reserved.
6#
7# Licensed under the Apache License, Version 2.0 (the "License"); you may
8# not use this file except in compliance with the License. You may obtain
9# a copy of the License at
10#
11# http://www.apache.org/licenses/LICENSE-2.0
12#
13# Unless required by applicable law or agreed to in writing, software
14# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16# License for the specific language governing permissions and limitations
17# under the License.
18"""
19Database models for authorization credentials and synchronizing Nova users.
20"""
21
22import datetime
23import random
24import re
25import sha
26from django.conf import settings
27from django.contrib.auth import models as auth_models
28from django.contrib.sites import models as site_models
29from django.core import mail
30from django.db import models
31from django.db.models.signals import post_save
32from django.template.loader import render_to_string
33from django_nova.connection import get_nova_admin_connection
34
35
36SHA1_RE=re.compile('^[a-f0-9]{40}$')
37
38
39class CredentialsAuthorization(models.Model):
40 username = models.CharField(max_length=128)
41 project = models.CharField(max_length=128)
42 auth_token = models.CharField(max_length=40)
43 auth_date = models.DateTimeField(auto_now_add=True)
44
45 def __str__(self):
46 return '%s/%s:%s' % (self.username, self.project, self.auth_token)
47
48 @classmethod
49 def get_by_token(cls, token):
50 if SHA1_RE.search(token):
51 try:
52 credentials = cls.objects.get(auth_token=token)
53 except cls.DoesNotExist:
54 return None
55 if not credentials.auth_token_expired():
56 return credentials
57 return None
58
59 @classmethod
60 def authorize(cls, username, project):
61 return cls.objects.create(username=username,
62 project=project,
63 auth_token=cls.create_auth_token(username))
64
65 @staticmethod
66 def create_auth_token(username):
67 salt = sha.new(str(random.random())).hexdigest()[:5]
68 return sha.new(salt+username).hexdigest()
69
70 def auth_token_expired(self):
71 expiration_date = datetime.timedelta(days=int(settings.CREDENTIAL_AUTHORIZATION_DAYS))
72
73 return self.auth_date + expiration_date <= datetime.datetime.now()
74
75 def get_download_url(self):
76 return settings.CREDENTIAL_DOWNLOAD_URL + self.auth_token
77
78 def get_zip(self):
79 nova = get_nova_admin_connection()
80 self.delete()
81 return nova.get_zip(self.username, self.project)
82
83
84def credentials_post_save(sender, instance, created, *args, **kwargs):
85 """
86 Creates a Nova User when a new Django User is created.
87 """
88 if created:
89 site = site_models.Site.objects.get_current()
90 user = auth_models.User.objects.get(username=instance.username)
91 context = {
92 'user': user,
93 'download_url': instance.get_download_url(),
94 'dashboard_url': 'http://%s/' % site.domain
95 }
96 subject = render_to_string('credentials/credentials_email_subject.txt')
97 body = render_to_string('credentials/credentials_email.txt', context)
98
99 message = mail.EmailMessage(subject=subject, body=body, to=[user.email])
100 message.send(fail_silently=False)
101post_save.connect(credentials_post_save,
102 CredentialsAuthorization,
103 dispatch_uid='django_nova.CredentialsAuthorization.post_save')
104
105
106def user_post_save(sender, instance, created, *args, **kwargs):
107 """
108 Creates a Nova User when a new Django User is created.
109 """
110
111 # NOTE(devcamcar): If running unit tests, don't use a real endpoint.
112 if settings.NOVA_DEFAULT_ENDPOINT == 'none':
113 return
114
115 if created:
116 nova = get_nova_admin_connection()
117 if not nova.has_user(instance.username):
118 nova.create_user(instance.username)
119post_save.connect(user_post_save,
120 auth_models.User,
121 dispatch_uid='django_nova.User.post_save')
1220
=== removed file 'src/django_nova/shortcuts.py'
--- src/django_nova/shortcuts.py 2011-01-31 20:24:02 +0000
+++ src/django_nova/shortcuts.py 1970-01-01 00:00:00 +0000
@@ -1,131 +0,0 @@
1# vim: tabstop=4 shiftwidth=4 softtabstop=4
2
3# Copyright 2010 United States Government as represented by the
4# Administrator of the National Aeronautics and Space Administration.
5# All Rights Reserved.
6#
7# Licensed under the Apache License, Version 2.0 (the "License"); you may
8# not use this file except in compliance with the License. You may obtain
9# a copy of the License at
10#
11# http://www.apache.org/licenses/LICENSE-2.0
12#
13# Unless required by applicable law or agreed to in writing, software
14# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
15# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
16# License for the specific language governing permissions and limitations
17# under the License.
18
19"""
20Helper methods for commonly used operations.
21"""
22
23from django.conf import settings
24from django.core.cache import cache
25from django.core.exceptions import PermissionDenied
26from django.http import Http404
27from django_nova import manager
28from django_nova.connection import get_nova_admin_connection
29from django_nova.exceptions import wrap_nova_error
30
31
32@wrap_nova_error
33def get_project_or_404(request, project_id):
34 """
35 Returns a project or 404s if it doesn't exist.
36 """
37
38 # Ensure that a connection is never attempted for a user that is unauthenticated.
39 if not request.user.is_authenticated:
40 raise PermissionDenied('User not authenticated')
41
42 nova = get_nova_admin_connection()
43 project = nova.get_project(project_id)
44 region = get_current_region(request)
45
46 if not project:
47 raise Http404('Project %s does not exist.' % project_id)
48
49 return manager.ProjectManager(request.user, project, region)
50
51
52@wrap_nova_error
53def get_projects(user):
54 """
55 Returns a list of projects for a user.
56 """
57 #key = 'projects.%s' % user
58 #projects = cache.get(key)
59
60 #if not projects:
61 # nova = get_nova_admin_connection()
62 # projects = nova.get_projects(user=user)
63 # cache.set(key, projects, 30)
64
65 #return projects
66 nova = get_nova_admin_connection()
67 return nova.get_projects(user=user)
68
69
70@wrap_nova_error
71def get_all_regions():
72 """
73 Returns a list of all regions.
74 """
75 regions = cache.get('regions')
76
77 if not regions:
78 nova = get_nova_admin_connection()
79 conn = nova.connection_for(settings.NOVA_ADMIN_USER, settings.NOVA_PROJECT)
80 results = conn.get_all_regions()
81 regions = [{'name': r.name, 'endpoint': r.endpoint} for r in results]
82 cache.set('regions', regions, 60 * 60 * 24)
83
84 return regions
85
86
87def get_region(region_name):
88 regions = get_all_regions()
89 try:
90 return [r for r in regions if r['name'] == region_name][0]
91 except IndexError:
92 return None
93
94
95def get_current_region(request):
96 """
97 Returns the currently selected region for a user.
98 """
99 region_name = request.session.get('region', settings.NOVA_DEFAULT_REGION)
100 return get_region(region_name)
101
102
103def set_current_region(request, region_name):
104 """
105 Sets the current region selection for a user.
106 """
107 request.session['region'] = region_name
108
109
110@wrap_nova_error
111def get_user_image_permissions(username, project_name):
112 """
113 Returns true if user is a sysadmin and can modify image attributes.
114 """
115 nova = get_nova_admin_connection()
116 user_has_modify_permissions = False
117
118 # checks global roles, if user is a sysadmin they can modify image attribtues.
119 if not user_has_modify_permissions:
120 for role in nova.get_user_roles(username):
121 if role.role == "sysadmin":
122 user_has_modify_permissions = True
123
124 # checks project roles, if user is a sysadmin they can modify image attribtues.
125 if not user_has_modify_permissions:
126 for role in nova.get_user_roles(username, project_name):
127 if role.role == "sysadmin":
128 user_has_modify_permissions = True
129
130 return user_has_modify_permissions
131
1320
=== removed directory 'src/django_nova/templates'
=== removed directory 'src/django_nova/templates/admin'
=== removed directory 'src/django_nova/templates/admin/django_nova'
=== removed directory 'src/django_nova/templates/admin/django_nova/project'
=== removed file 'src/django_nova/templates/admin/django_nova/project/add_project.html'
--- src/django_nova/templates/admin/django_nova/project/add_project.html 2011-01-12 20:02:06 +0000
+++ src/django_nova/templates/admin/django_nova/project/add_project.html 1970-01-01 00:00:00 +0000
@@ -1,45 +0,0 @@
1{% extends "admin/django_nova/project/base_projects.html" %}
2{% load admin_modify adminmedia %}
3
4{% block extrahead %}
5{{ block.super }}
6{{ media }}
7{% endblock %}
8
9{% block extrastyle %}{{ block.super }}<link rel="stylesheet" type="text/css" href="{% admin_media_prefix %}css/forms.css" />{% endblock %}
10
11{% block coltype %}colMS{% endblock %}
12
13{% block bodyclass %} change-form{% endblock %}
14
15{% block breadcrumbs %}
16<div class="breadcrumbs">
17 <a href="/admin">Home</a> &rsaquo;
18 <a href="../../projects">Projects</a> &rsaquo;
19 Add Project
20</div>
21{% endblock %}
22
23{% block content %}
24<div id="content-main">
25 {% block object-tools %}
26 {% endblock %}
27 <form action="." method="post" enctype="multipart/form-data">
28 {% csrf_token %}
29 <fieldset class="module aligned {{ fieldset.classes }}">
30 {% for field in form.visible_fields %}
31 <div class="form-row">
32 {{ field.errors }}
33 {{ field.label_tag }}{{ field }}
34 {% if field.field.help_text %}<p class="help">{{ field.field.help_text|safe }}</p>{% endif %}
35 </div>
36 {% endfor %}
37 {% for field in form.hidden_fields %}
38 {{ field }}
39 {% endfor %}
40
41 </fieldset>
42 <input type="submit" value="Save" />
43 </form>
44</div>
45{% endblock %}
460
=== removed file 'src/django_nova/templates/admin/django_nova/project/add_project_user.html'
--- src/django_nova/templates/admin/django_nova/project/add_project_user.html 2011-01-12 20:02:06 +0000
+++ src/django_nova/templates/admin/django_nova/project/add_project_user.html 1970-01-01 00:00:00 +0000
@@ -1,69 +0,0 @@
1{% extends "admin/django_nova/project/base_projects.html" %}
2{% load admin_modify adminmedia %}
3
4{% block extrahead %}
5{{ block.super }}
6{{ media }}
7
8<script type="text/javascript" src="/media/admin/js/jquery.min.js"></script>
9<script type="text/javascript" src="/media/admin/js/jquery.init.js"></script>
10
11<script type="text/javascript" src="/media/dashboard/js/django-admin.multiselect.js"></script>
12<link rel="stylesheet" type="text/css" href="/media/dashboard/css/django-admin-widgets.css" />
13
14<script type="text/javascript" charset="utf-8">
15 django.jQuery(function(){
16 django.jQuery.each(django.jQuery(".edit_user_roles select[multiple]"), function () {
17 // "Locations" can be any label you want
18 SelectFilter.init(this.id, "Roles", 0, "/media/admin/");
19 });
20 })
21</script>
22{% endblock %}
23
24{% block extrastyle %}{{ block.super }}<link rel="stylesheet" type="text/css" href="{% admin_media_prefix %}css/forms.css" />{% endblock %}
25
26{% block coltype %}colMS{% endblock %}
27
28{% block bodyclass %} change-form{% endblock %}
29
30{% block breadcrumbs %}
31<div class="breadcrumbs">
32 <a href="/admin">Home</a> &rsaquo;
33 <a href="{% url admin_projects %}">Projects</a> &rsaquo;
34 <a href="{% url admin_project project.projectname %}">{{project.projectname}}</a> &rsaquo;
35 User
36 {{form.ProjectUserForm}}
37</div>
38{% endblock %}
39
40{% block content %}
41<div id="content-main">
42 {% block object-tools %}
43 {% endblock %}
44 <form class="edit_user_roles" action="." method="post" enctype="multipart/form-data">
45 {% csrf_token %}
46 <fieldset class="module aligned {{ fieldset.classes }}">
47 <input type="hidden" name="username" value="{{user.id}}" id="username" />
48 {% for field in form.visible_fields %}
49 <div class="form-row">
50 {{ field.errors }}
51 {{ field.label_tag }}{{ field }}
52 {% if field.field.help_text %}<p class="help">{{ field.field.help_text|safe }}</p>{% endif %}
53 </div>
54 {% endfor %}
55 {% for field in form.hidden_fields %}
56 {{ field }}
57 {% endfor %}
58
59 </fieldset>
60 <div class="submit-row">
61 <p class="deletelink-box">
62 <a href="{% url admin_project_delete_user project.projectname user.username %}" class="deletelink">Delete</a>
63 </p>
64 <input type="submit" value="Save" class="default" />
65 </div>
66
67 </form>
68</div>
69{% endblock %}
700
=== removed file 'src/django_nova/templates/admin/django_nova/project/base_projects.html'
--- src/django_nova/templates/admin/django_nova/project/base_projects.html 2011-01-12 20:02:06 +0000
+++ src/django_nova/templates/admin/django_nova/project/base_projects.html 1970-01-01 00:00:00 +0000
@@ -1,16 +0,0 @@
1{% extends "admin/change_list.html" %}
2
3{% block extrastyle %}
4 {{block.super}}
5 <link rel="stylesheet" type="text/css" href="{{settings.MEDIA_URL}}/stylesheets/extra_admin.css" />
6{% endblock %}
7{% block breadcrumbs %}<div class="breadcrumbs"><a href="/admin/">Home</a>&nbsp;&rsaquo;&nbsp;Projects</div>{% endblock %}
8{% block content %}
9 <div id="content-main">
10 <div class="module filtered" id="changelist">
11 <div id="toolbartable">
12 {% block innercontent %}{% endblock %}
13 </div>
14 </div>
15 </div>
16{% endblock %}
170
=== removed file 'src/django_nova/templates/admin/django_nova/project/change_list.html'
--- src/django_nova/templates/admin/django_nova/project/change_list.html 2011-01-12 20:02:06 +0000
+++ src/django_nova/templates/admin/django_nova/project/change_list.html 1970-01-01 00:00:00 +0000
@@ -1,3 +0,0 @@
1{% extends "admin/change_list.html" %}
2{% load admin_extras %}
3{% block result_list %}{% project_result_list cl %}{% endblock %}
4\ No newline at end of file0\ No newline at end of file
51
=== removed file 'src/django_nova/templates/admin/django_nova/project/delete_project.html'
--- src/django_nova/templates/admin/django_nova/project/delete_project.html 2011-01-12 20:02:06 +0000
+++ src/django_nova/templates/admin/django_nova/project/delete_project.html 1970-01-01 00:00:00 +0000
@@ -1,25 +0,0 @@
1{% extends "admin/change_list.html" %}
2
3{% block extrastyle %}
4 {{block.super}}
5 <link rel="stylesheet" type="text/css" href="{{settings.MEDIA_URL}}/stylesheets/extra_admin.css" />
6{% endblock %}
7{% block breadcrumbs %}<div class="breadcrumbs"><a href="/admin/">Home</a>&nbsp;&rsaquo;&nbsp;<a href="/admin/projects">Projects</a>&nbsp;&rsaquo;&nbsp; <a href="{% url admin_project project.projectname %}">{{project.projectname}}</a>&nbsp;&rsaquo;&nbsp;Delete</div>{% endblock %}
8{% block content %}
9 <div id="content-main">
10 <div class="module filtered" id="changelist">
11 <div id="toolbartable">
12 <h1>Delete Project</h1>
13 <p>Do you really want to delete this project?</p>
14 <ul>
15 <li><a href="{% url admin_project project.projectname %}">{{project.projectname}}</a></li>
16 </ul>
17
18 <form action="." method="post">
19 {% csrf_token %}
20 <p><input type="submit" value="Delete"></p>
21 </form>
22 </div>
23 </div>
24 </div>
25{% endblock %}
260
=== removed file 'src/django_nova/templates/admin/django_nova/project/delete_project_user.html'
--- src/django_nova/templates/admin/django_nova/project/delete_project_user.html 2011-01-12 20:02:06 +0000
+++ src/django_nova/templates/admin/django_nova/project/delete_project_user.html 1970-01-01 00:00:00 +0000
@@ -1,25 +0,0 @@
1{% extends "admin/change_list.html" %}
2
3{% block extrastyle %}
4 {{block.super}}
5 <link rel="stylesheet" type="text/css" href="{{settings.MEDIA_URL}}/stylesheets/extra_admin.css" />
6{% endblock %}
7{% block breadcrumbs %}<div class="breadcrumbs"><a href="/admin/">Home</a>&nbsp;&rsaquo;&nbsp;<a href="/admin/projects">Projects</a>&nbsp;&rsaquo;&nbsp; <a href="{% url admin_project project.projectname %}">{{project.projectname}}</a>&nbsp;&rsaquo;&nbsp;Delete</div>{% endblock %}
8{% block content %}
9 <div id="content-main">
10 <div class="module filtered" id="changelist">
11 <div id="toolbartable">
12 <h1>Remove User From Project</h1>
13 <p>Do you really want to remove this user from project?</p>
14 <ul>
15 <li><a href="{% url project_user project.projectname user.username %}">{{user.username}}</a> from <a href="{% url admin_project project.projectname %}">{{project.projectname}}</a></li>
16 </ul>
17
18 <form action="." method="post">
19 {% csrf_token %}
20 <p><input type="submit" value="Delete"></p>
21 </form>
22 </div>
23 </div>
24 </div>
25{% endblock %}
260
=== removed file 'src/django_nova/templates/admin/django_nova/project/edit_project.html'
--- src/django_nova/templates/admin/django_nova/project/edit_project.html 2011-01-12 20:02:06 +0000
+++ src/django_nova/templates/admin/django_nova/project/edit_project.html 1970-01-01 00:00:00 +0000
@@ -1,95 +0,0 @@
1{% extends "admin/django_nova/project/base_projects.html" %}
2{% load admin_modify adminmedia %}
3
4{% block extrahead %}
5{{ block.super }}
6{{ media }}
7{% endblock %}
8
9{% block extrastyle %}{{ block.super }}<link rel="stylesheet" type="text/css" href="{% admin_media_prefix %}css/forms.css" />{% endblock %}
10
11{% block coltype %}colMS{% endblock %}
12
13{% block bodyclass %} change-form{% endblock %}
14
15{% block breadcrumbs %}
16<div class="breadcrumbs">
17 <a href="/admin">Home</a> &rsaquo;
18 <a href="{% url admin_projects %}">Projects</a> &rsaquo;
19 <a href="{% url admin_project project.projectname %}">{{project.projectname}}</a> &rsaquo;
20 Edit Project
21 {{form.ProjectEditForm}}
22</div>
23{% endblock %}
24
25{% block content %}
26<div id="content-main">
27 {% block object-tools %}
28 {% endblock %}
29 <form action="#" method="post" enctype="multipart/form-data">
30 {% csrf_token %}
31 <fieldset class="module aligned {{ fieldset.classes }}">
32 {% for field in form.visible_fields %}
33 <div class="form-row">
34 {{ field.errors }}
35 {{ field.label_tag }}{{ field }}
36 {% if field.field.help_text %}<p class="help">{{ field.field.help_text|safe }}</p>{% endif %}
37 </div>
38 {% endfor %}
39 {% for field in form.hidden_fields %}
40 {{ field }}
41 {% endfor %}
42 <div class="form-row">
43 <label for="project_name">Project Name</label>
44 <span id="project_name" style="display: block; padding-top: 5px; padding-left: 5px; float: left;"><em>{{projectname}}</em></span>
45 </div>
46 <div class="form-row">
47 <label for="project_description">Description</label>
48 <span id="project_description" style="display: block; padding-top: 5px; padding-left: 5px; float: left;"><em>{{description}}</em></span>
49 </div>
50 <div class="form-row">
51 <label for="project_manager">Project Manager</label>
52 <span id="project_manager" style="display: block; padding-top: 5px; padding-left: 5px; float: left;"><em>{{manager}}</em></span>
53 </div>
54 </fieldset>
55 <div class="submit-row">
56 <p class="deletelink-box">
57 <a href="{% url delete_project project.projectname %}" class="deletelink">Delete Project</a>
58 </p>
59 {# <input type="submit" value="Save" class="default" /> #}
60 </div>
61
62 </form>
63
64
65 <table cellspacing="0" style="margin-top: 20px;">
66 <thead>
67 <tr>
68 <th>Username</th>
69 <th>Project Roles</th>
70 <th>Global Roles</th>
71 </tr>
72 </thead>
73 {% for user in users %}
74 <tr class="{% cycle 'row1' 'row2' %}">
75 <td>
76 <a href="{%url project_user project.projectname user.memberId %}">{{user.memberId}} {% if user.memberId == project.projectManagerId %}(<em>project manager</em>){%endif %}</a>
77
78 </td>
79 <td>
80 {{user.project_roles}}
81 </td>
82 <td>
83 {{user.global_roles}}
84 </td>
85 </tr>
86 {% endfor %}
87 </table>
88 <ul class="object-tools">
89 <li>
90 <a class="addlink" href="{% url add_project_user project.projectname %}">Add User</a>
91 </li>
92 </ul>
93
94</div>
95{% endblock %}
960
=== removed file 'src/django_nova/templates/admin/django_nova/project/global_edit_user.html'
--- src/django_nova/templates/admin/django_nova/project/global_edit_user.html 2011-01-12 20:02:06 +0000
+++ src/django_nova/templates/admin/django_nova/project/global_edit_user.html 1970-01-01 00:00:00 +0000
@@ -1,71 +0,0 @@
1{% extends "admin/django_nova/project/base_projects.html" %}
2{% load admin_modify adminmedia %}
3
4{% block extrahead %}
5{{ block.super }}
6{{ media }}
7
8<script type="text/javascript" src="/media/admin/js/jquery.min.js"></script>
9<script type="text/javascript" src="/media/admin/js/jquery.init.js"></script>
10
11<script type="text/javascript" src="/media/dashboard/js/django-admin.multiselect.js"></script>
12<link rel="stylesheet" type="text/css" href="/media/dashboard/css/django-admin-widgets.css" />
13
14<script type="text/javascript" charset="utf-8">
15 django.jQuery(function(){
16 django.jQuery.each(django.jQuery("#global_users select"), function () {
17 // "Locations" can be any label you want
18 SelectFilter.init(this.id, "Roles", 0, "/media/admin/");
19 });
20 })
21</script>
22{% endblock %}
23
24{% block extrastyle %}{{ block.super }}<link rel="stylesheet" type="text/css" href="{% admin_media_prefix %}css/forms.css" />{% endblock %}
25
26{% block coltype %}colMS{% endblock %}
27
28{% block bodyclass %} change-form{% endblock %}
29
30{% block breadcrumbs %}
31<div class="breadcrumbs">
32 <a href="/admin">Home</a> &rsaquo;
33 <a href="{% url admin_users_list %}">Global Roles</a> &rsaquo;
34 {{user.username}}
35</div>
36{% endblock %}
37
38{% block content %}
39<div id="content-main">
40 {% block object-tools %}
41 {% endblock %}
42 <form action="." method="post" enctype="multipart/form-data" id="global_users">
43 {% csrf_token %}
44 <fieldset class="module aligned {{ fieldset.classes }}">
45 <div class="form-row">
46 <label for="id_username">Username</label>
47 <span>{{user.username}}</span>
48 </div>
49 <input type="hidden" name="username" value="{{user.id}}" id="username" />
50 {% for field in form.visible_fields %}
51 <div class="form-row">
52 {{ field.errors }}
53 {{ field.label_tag }}{{ field }}
54 {% if field.field.help_text %}<p class="help">{{ field.field.help_text|safe }}</p>{% endif %}
55 </div>
56 {% endfor %}
57 {% for field in form.hidden_fields %}
58 {{ field }}
59 {% endfor %}
60
61 </fieldset>
62 <div class="submit-row">
63 <p class="deletelink-box">
64 {# <a href="{% url admin_project_delete_user project.projectname user.username %}" class="deletelink">Delete</a> #}
65 </p>
66 <input type="submit" value="Save" class="default" />
67 </div>
68
69 </form>
70</div>
71{% endblock %}
720
=== removed file 'src/django_nova/templates/admin/django_nova/project/project_list.html'
--- src/django_nova/templates/admin/django_nova/project/project_list.html 2011-01-12 20:02:06 +0000
+++ src/django_nova/templates/admin/django_nova/project/project_list.html 1970-01-01 00:00:00 +0000
@@ -1,42 +0,0 @@
1{% extends "admin/django_nova/project/base_projects.html" %}
2{% block extrahead %}
3 {{ block.super }}
4{% endblock %}
5{% block innercontent %}
6 <ul class="object-tools">
7 <li>
8 <a class="addlink" href="{% url add_project %}">Add Project</a>
9 </li>
10 </ul>
11 <table cellspacing="0" style="margin-top: 20px;">
12 <thead>
13 <tr>
14 <th>Name</th>
15 <th>Description</th>
16 <th>Project Manager</th>
17 <th>Send Credentials</th>
18 <th>Start VPN</th>
19 </tr>
20 </thead>
21 {% for project in projects %}
22 <tr class="{% cycle 'row1' 'row2' %}">
23 <td>
24 <a href="{%url admin_project project.projectname %}">{{project.projectname}}</a>
25 </td>
26 <td>
27 {{project.description}}
28 </td>
29 <td>
30 {{project.projectManagerId}}
31 </td>
32 <td>
33 <a href="{% url admin_project_sendcredentials project.projectname %}">Send Credentials</a>
34 </td>
35 <td>
36 <a href="{% url admin_project_start_vpn project.projectname %}">Start VPN</a>
37 </td>
38
39 </tr>
40 {% endfor %}
41 </table>
42{% endblock %}
430
=== removed file 'src/django_nova/templates/admin/django_nova/project/project_user.html'
--- src/django_nova/templates/admin/django_nova/project/project_user.html 2011-01-12 20:02:06 +0000
+++ src/django_nova/templates/admin/django_nova/project/project_user.html 1970-01-01 00:00:00 +0000
@@ -1,76 +0,0 @@
1{% extends "admin/django_nova/project/base_projects.html" %}
2{% load admin_modify adminmedia %}
3
4{% block extrahead %}
5{{ block.super }}
6{{ media }}
7
8<script type="text/javascript" src="/media/admin/js/jquery.min.js"></script>
9<script type="text/javascript" src="/media/admin/js/jquery.init.js"></script>
10
11<script type="text/javascript" src="/media/dashboard/js/django-admin.multiselect.js"></script>
12<link rel="stylesheet" type="text/css" href="/media/dashboard/css/django-admin-widgets.css" />
13
14<script type="text/javascript" charset="utf-8">
15 django.jQuery(function(){
16 django.jQuery.each(django.jQuery(".edit_user_roles select[multiple]"), function () {
17 // "Locations" can be any label you want
18 SelectFilter.init(this.id, "Roles", 0, "/media/admin/");
19 });
20 })
21</script>
22{% endblock %}
23
24{% block extrastyle %}{{ block.super }}<link rel="stylesheet" type="text/css" href="{% admin_media_prefix %}css/forms.css" />{% endblock %}
25
26{% block coltype %}colMS{% endblock %}
27
28{% block bodyclass %} change-form{% endblock %}
29
30{% block breadcrumbs %}
31<div class="breadcrumbs">
32 <a href="/admin">Home</a> &rsaquo;
33 <a href="{% url admin_projects %}">Projects</a> &rsaquo;
34 <a href="{% url admin_project project.projectname %}">{{project.projectname}}</a> &rsaquo;
35 User
36 {{form.ProjectUserForm}}
37</div>
38{% endblock %}
39
40{% block content %}
41<div id="content-main">
42 {% block object-tools %}
43 {% endblock %}
44 <form class="edit_user_roles" action="." method="post" enctype="multipart/form-data">
45 {% csrf_token %}
46 <fieldset class="module aligned {{ fieldset.classes }}">
47 <div class="form-row">
48 <label for="id_username">Username</label>
49 <span>{{user.username}}</span>
50 </div>
51 <input type="hidden" name="username" value="{{user.id}}" id="username" />
52 {% for field in form.visible_fields %}
53 <div class="form-row">
54 {{ field.errors }}
55 {{ field.label_tag }}{{ field }}
56 {% if field.field.help_text %}<p class="help">{{ field.field.help_text|safe }}</p>{% endif %}
57 </div>
58 {% endfor %}
59 {% for field in form.hidden_fields %}
60 {{ field }}
61 {% endfor %}
62
63 </fieldset>
64 <div class="submit-row">
65 {% if project.projectManagerId != user.username %}
66 <p class="deletelink-box">
67 <a href="{% url admin_project_delete_user project.projectname user.username %}" class="deletelink">Remove User From Project</a>
68 </p>
69 {% endif %}
70
71 <input type="submit" value="Save" class="default" />
72 </div>
73
74 </form>
75</div>
76{% endblock %}
770
=== removed file 'src/django_nova/templates/admin/django_nova/project/send_credentials.html'
--- src/django_nova/templates/admin/django_nova/project/send_credentials.html 2011-01-12 20:02:06 +0000
+++ src/django_nova/templates/admin/django_nova/project/send_credentials.html 1970-01-01 00:00:00 +0000
@@ -1,87 +0,0 @@
1{% extends "admin/base_site.html" %}
2{% load i18n admin_modify adminmedia %}
3
4{% block title %}Send project credentials{{ block.super }}{% endblock %}
5
6{% block extrahead %}
7{{ block.super }}
8{{ media }}
9
10<script type="text/javascript" src="/media/admin/js/jquery.min.js"></script>
11<script type="text/javascript" src="/media/admin/js/jquery.init.js"></script>
12
13<script type="text/javascript" src="/media/dashboard/js/django-admin.multiselect.js"></script>
14<link rel="stylesheet" type="text/css" href="/media/dashboard/css/django-admin-widgets.css" />
15
16<script type="text/javascript" charset="utf-8">
17 django.jQuery(function(){
18 django.jQuery.each(django.jQuery("#send_credentials select"), function () {
19 // "Locations" can be any label you want
20 SelectFilter.init(this.id, "Users", 0, "/media/admin/");
21 });
22 })
23</script>
24
25<style type="text/css" media="screen">
26 .errorlist, .successlist {background:#fcc;border:1px solid #c66;color:#600;list-style:none; padding: 10px 5px; margin: 25px 0 25px 0; float: left; width: 100%;}
27 .successlist {background: #CBFBD7; color: #1E5024; border-color: #6FBA5C;}
28</style>
29{% endblock %}
30
31
32{% block breadcrumbs %}
33<div class="breadcrumbs">
34 <a href="/admin">Home</a> &rsaquo;
35 <a href="{% url admin_projects %}">Projects</a> &rsaquo;
36 <a href="{% url admin_project project.projectname %}">{{project.projectname}}</a> &rsaquo;
37 Send Credentials
38</div>
39{% endblock %}
40
41{% block content %}
42<div id="content-main">
43
44
45 {% if not success %}
46 <h1>Send Credentials</h1>
47 <h3>Select which users you would like to send credentials to from the '{{ project.projectname }}' project.</h3>
48 {% else %}
49 <h1>Credentials sent successfully</h1>
50 {% endif %}
51
52 <div class="status">
53 {% if error %}
54 <span class="errorlist">{{ error }}</span>
55 {% endif %}
56
57 {% if success %}
58 <span class="successlist">{{ success }}</span>
59 {% endif %}
60
61 </div>
62
63 {% if not success %}
64 <form id="send_credentials" action="{% url admin_project_sendcredentials project.projectname %}" method="post">
65 {% csrf_token %}
66 <fieldset class="module aligned">
67
68 {% for field in form.visible_fields %}
69 <div class="form-row">
70 {{ field.errors }}
71 {{ field }}
72 {% if field.field.help_text %}<p class="help">{{ field.field.help_text|safe }}</p>{% endif %}
73 </div>
74 {% endfor %}
75 {% for field in form.hidden_fields %}
76 {{ field }}
77 {% endfor %}
78
79 </fieldset>
80 <div class="submit-row">
81 <input style="margin-top:20px; margin-left:10px;" type="submit" value="Send Credentials" />
82 </div>
83
84 </form>
85 {% endif %}
86</div>
87{% endblock %}
880
=== removed file 'src/django_nova/templates/admin/django_nova/project/user_list.html'
--- src/django_nova/templates/admin/django_nova/project/user_list.html 2011-01-12 20:02:06 +0000
+++ src/django_nova/templates/admin/django_nova/project/user_list.html 1970-01-01 00:00:00 +0000
@@ -1,39 +0,0 @@
1{% extends "admin/django_nova/project/base_projects.html" %}
2{% block extrahead %}
3 {{ block.super }}
4{% endblock %}
5
6{% block breadcrumbs %}
7<div class="breadcrumbs">
8 <a href="/admin">Home</a> &rsaquo;
9 Global Roles
10</div>
11{% endblock %}
12
13{% block innercontent %}
14 <h1>Select a User</h1>
15
16 <table cellspacing="0" style="margin-top: 20px;">
17 <thead>
18 <tr>
19 <th>Username</th>
20 <th>Global Roles</th>
21 <th>Actions</th>
22 </tr>
23 </thead>
24 {% for user in users %}
25 <tr class="{% cycle 'row1' 'row2' %}">
26 <td>
27 {{user.username}}
28 </td>
29 <td>
30 (temporarily hidden)
31 {#user.roles#}
32 </td>
33 <td>
34 <a href="{%url admin_user_roles user.username %}">Edit</a>
35 </td>
36 </tr>
37 {% endfor %}
38 </table>
39{% endblock %}
400
=== removed directory 'src/django_nova/templates/django_nova'
=== removed file 'src/django_nova/templates/django_nova/_messages.html'
--- src/django_nova/templates/django_nova/_messages.html 2011-01-12 20:02:06 +0000
+++ src/django_nova/templates/django_nova/_messages.html 1970-01-01 00:00:00 +0000
@@ -1,41 +0,0 @@
1{% for message in messages %}
2 <div class="message ui-widget">
3 {% if message.tags == "info" %}
4 <div class="ui-state-highlight ui-corner-all">
5 <span class="close ui-icon ui-icon-circle-close"></span>
6 <p>
7 <span class="ui-icon ui-icon-info"></span>
8 {{ message }}
9 </p>
10 </div>
11 {% endif %}
12 {% if message.tags == "warning" %}
13 <div class="ui-state-highlight ui-corner-all" >
14 <span class="close ui-icon ui-icon-circle-close"></span>
15 <p>
16 <span class="ui-icon ui-icon-alert"></span>
17 {{ message }}
18 </p>
19 </div>
20 {% endif %}
21 {% if message.tags == "success" %}
22 <div class="ui-state-highlight ui-corner-all success" >
23 <span class="close ui-icon ui-icon-circle-close"></span>
24 <p>
25 <span class="ui-icon ui-icon-check"></span>
26 {{ message }}
27 </p>
28 </div>
29 {% endif %}
30 {% if message.tags == "error" %}
31 <div class="ui-state-error ui-corner-all" >
32 <span class="close ui-icon ui-icon-circle-close"></span>
33 <p>
34 <span class="ui-icon ui-icon-alert"></span>
35 {{ message }}
36 </p>
37 </div>
38 {% endif %}
39 </div>
40{% endfor %}
41
420
=== removed file 'src/django_nova/templates/django_nova/base.html'
--- src/django_nova/templates/django_nova/base.html 2011-01-18 21:53:47 +0000
+++ src/django_nova/templates/django_nova/base.html 1970-01-01 00:00:00 +0000
@@ -1,85 +0,0 @@
1{% extends "base-sidebar.html" %}
2{% load region_tags %}
3{% load project_tags %}
4
5{% block headerjs %}
6{{ block.super }}
7{% endblock %}
8
9{% block region %}
10 <div id="region_selector">
11 {% load_regions %}
12 <span id="project_name"><strong>Project:</strong> {{ project.projectname }}</span>
13
14 <form id="frm_region" method="post" action="{% url region_change %}">
15 {% csrf_token %}
16 <fieldset>
17 <input name="redirect_url" type="hidden" value="{{ request.get_full_path }}" />
18 <noscript>
19 <input id="btn_region_change" type="submit" value="Change" />
20 </noscript>
21
22 <div id="region_form">
23 <label for="sel_region">Region: </label>
24 <select id="sel_region" name="region">
25 {% for region in regions %}
26 <option{% if region.name == current_region.name %} selected{% endif %}>
27 {{ region.name }}
28 </option>
29 {% endfor %}
30 </select>
31 </div>
32
33 </fieldset>
34 </form>
35 </div>
36{% endblock %}
37
38{% block nav_projects %}
39 {% load_projects %}
40 <li>
41 <h3 class="active"><a href="/">Projects</a></h3>
42 <div id="projects">
43 {% for p in projects %}
44 <div id="{{ p.projectname }}" class="project{% if p.projectname == project.projectname %} active{% endif %}">
45 <h4>
46 <a class="project_link" href="/project/{{ p.projectname }}">{{ p.projectname }}</a>
47 {% if p.projectManagerId == user.username %}
48 <a id="manage_project_{{p.projectname}}"
49 class="manage_link"
50 href="{% url nova_project_manage p.projectname %}"
51 title="Manage User Roles">Manage Project</a>
52 {% endif %}
53 </h4>
54 {% if project.projectname == p.projectname %}
55 <ul>
56 <li {% if p.projectname == project.projectname and sidebar_selected == "instances" %}class="active"{% endif %}>
57 <a id="lnk_instances_{{p.projectname}}" href="{% url nova_instances p.projectname %}">Instances</a>
58 </li>
59 <li {% if p.projectname == project.projectname and sidebar_selected == "images" %}class="active"{% endif %}>
60 <a id="lnk_images_{{p.projectname}}" href="{% url nova_images p.projectname %}">Images</a>
61 </li>
62 <li {% if p.projectname == project.projectname and sidebar_selected == "keys" %}class="active"{% endif %}>
63 <a id="lnk_keypairs_{{p.projectname}}" href="{% url nova_keypairs p.projectname %}">Keys</a>
64 </li>
65 <li {% if p.projectname == project.projectname and sidebar_selected == "volumes" %}class="active"{% endif %}>
66 <a id="lnk_volumes_{{p.projectname}}" href="{% url nova_volumes p.projectname %}">Volumes</a>
67 </li>
68 </ul>
69 {% endif %}
70 </div>
71 {% endfor %}
72 </div>
73 </li>
74{% endblock %}
75
76{% block footerjs %}
77{{ block.super }}
78<script type="text/javascript">
79 $(function() {
80 $('#sel_region').change(function() {
81 $('#frm_region').submit();
82 });
83 });
84</script>
85{% endblock %}
860
=== removed directory 'src/django_nova/templates/django_nova/credentials'
=== removed file 'src/django_nova/templates/django_nova/credentials/expired.html'
--- src/django_nova/templates/django_nova/credentials/expired.html 2011-02-01 19:18:59 +0000
+++ src/django_nova/templates/django_nova/credentials/expired.html 1970-01-01 00:00:00 +0000
@@ -1,17 +0,0 @@
1{% load django_nova_tags %}
2<!DOCTYPE html>
3<html lang="en" xml:lang="en">
4 <head>
5 <meta http-equiv="content-type" content="text/html; charset=utf-8" />
6 <title>Expired Token</title>
7 </head>
8 <body>
9 <center>
10 <h1>The link you clicked has expired.</h1>
11 <p style="width:460px;">This credentials download link you have reached
12 is either invalid or has expired. Each link is only good for one use. If
13 you need to download your credentials again, please contact the
14 {% site_branding %} support team.</p>
15 </center>
16 </body>
17</html>
180
=== removed directory 'src/django_nova/templates/django_nova/images'
=== removed file 'src/django_nova/templates/django_nova/images/_launch_form.html'
--- src/django_nova/templates/django_nova/images/_launch_form.html 2011-01-12 20:02:06 +0000
+++ src/django_nova/templates/django_nova/images/_launch_form.html 1970-01-01 00:00:00 +0000
@@ -1,7 +0,0 @@
1{% for field in form %}
2<div class="{% cycle 'odd' 'even'%}">
3 {{ field.label_tag }}
4 {% if field.errors %}{{ field.errors }}{% endif %}
5 {{ field }}
6</div>
7{% endfor %}
80
=== removed file 'src/django_nova/templates/django_nova/images/_list.html'
--- src/django_nova/templates/django_nova/images/_list.html 2011-03-01 04:13:08 +0000
+++ src/django_nova/templates/django_nova/images/_list.html 1970-01-01 00:00:00 +0000
@@ -1,112 +0,0 @@
1 <h3 class="image_list_heading"> {{ heading }} </h3>
2 {% if images %}
3 <table id="image_launch">
4 <tr>
5 <th>ID</th>
6 <th>Description</th>
7 <th colspan="2">Owner</th>
8 </tr>
9 {% for image in images %}
10 {% if image.id == ami.id %}
11 <td class="detail_wrapper" colspan="4">
12 <div id="{{ ami.id }}" class="image_detail">
13 <div class="column">
14 <div class="image_detail_item">
15 <span class="label">Owner: </span>
16 <span class="data">{{ ami.ownerId }}</span>
17 </div>
18
19 <div class="image_detail_item">
20 <span class="label">Description: </span>
21 <span class="data">{{ ami.description }}</span>
22 </div>
23
24 <div class="image_detail_item">
25 <span class="label">Location: </span>
26 <span class="data">{{ ami.location }}</span>
27 </div>
28 </div>
29
30 <div class="column">
31 <div class="image_detail_item">
32 <span class="label">ID: </span>
33 <span class="data">{{ ami.id }}</span>
34 </div>
35 <div class="image_detail_item">
36 <span class="label">Name: </span>
37 <span class="data">{% if ami.displayName %}{{ ami.displayName }}{%else%}{{ ami.id }}{% endif %}</span>
38 </div>
39 <div class="image_detail_item">
40 <span class="label">Type: </span>
41 <span class="data">{{ ami.type }}</span>
42 </div>
43 <div class="image_detail_item">
44 <span class="label">Architecture: </span>
45 <span class="data">{{ ami.architecture }}</span>
46 </div>
47 </div>
48
49 <div id="last" class="column">
50 {% if ami.is_public %}
51 <div id="public" class="privacy">Public Image</div>
52 {% else %}
53 <div id="private" class="privacy">Private Image</div>
54 {% endif %}
55
56 <a id="launch_{{ image.id }}" class="launch" href="{% url nova_images_launch project.projectname image.id %}" title="Click to launch image">Launch</a>
57 {% if can_modify or user.username == ami.ownerId %}
58 <a id="edit_image_link" href="{% url nova_images_update project.projectname ami.id %}">Edit Image</a>
59 {% endif %}
60
61 </div>
62
63 {% if can_modify or user.username == ami.ownerId %}
64 <span class="image_privacy">
65 <form id="privacy_{{ ami.id }}" action="{% url nova_images_privacy project.projectname ami.id %}" method="post" accept-charset="utf-8">
66 {% csrf_token %}
67 {% if ami.is_public %}
68 <input class="private" type="submit" value="Make Private" />
69 {% else %}
70 <input class="public" type="submit" value="Make Public" />
71 {% endif %}
72 </form>
73 </span>
74
75 <span class="delete">
76 <form id="delete_{{ ami.id }}" action="{% url nova_images_remove project.projectname ami.id %}" method="post" accept-charset="utf-8">
77 {% csrf_token %}
78 <input type="submit" value="Remove Image" />
79 </form>
80 </span>
81 {% endif %}
82 </div>
83 </td>
84 {% else %}
85 <tr class="{% cycle 'odd' 'even' %}">
86 <td class="image_id">
87 <a href="{% url nova_images_detail project.projectname image.id %}">{% if image.displayName %}{{ image.displayName }}{%else%}{{ image.id }}{% endif %}</a>
88 </td>
89 <td class="image_location odd">
90 {% if image.description %}
91 {{ image.description }}
92 {% else %}
93 {{ image.location }}
94 {% endif %}
95 </td>
96 <td class="image_owner_id">{{ image.ownerId }}</td>
97 <td class="image_launch_btn odd"><a id="launch_{{ image.id }}" class="launch" href="{% url nova_images_launch project.projectname image.id %}">Launch</a></td>
98 {#<td class="odd"><a class="ui-state-default ui-corner-all" onclick="$('#dlg_launch').dialog('open');">Launch</a></td>#}
99 </tr>
100 {% endif %}
101 {% endfor %}
102 </table>
103 {% else %}
104 <div class="ui-widget">
105 <div class="ui-state-highlight ui-corner-all">
106 <p>
107 <span class="ui-icon ui-icon-info"></span>
108 No images currently available.
109 </p>
110 </div>
111 </div>
112 {% endif %}
1130
=== removed file 'src/django_nova/templates/django_nova/images/base.html'
--- src/django_nova/templates/django_nova/images/base.html 2011-01-16 21:28:02 +0000
+++ src/django_nova/templates/django_nova/images/base.html 1970-01-01 00:00:00 +0000
@@ -1,7 +0,0 @@
1{% extends "django_nova/base.html" %}
2{% load sidebar_tags %}
3
4{% block nav_projects %}
5 {% sidebar_select images %}
6 {{ block.super }}
7{% endblock %}
8\ No newline at end of file0\ No newline at end of file
91
=== removed file 'src/django_nova/templates/django_nova/images/detail_list.html'
--- src/django_nova/templates/django_nova/images/detail_list.html 2011-03-01 04:13:08 +0000
+++ src/django_nova/templates/django_nova/images/detail_list.html 1970-01-01 00:00:00 +0000
@@ -1,207 +0,0 @@
1{% extends "django_nova/images/base.html" %}
2
3{% block title %} - Launch an Image{% endblock %}
4
5{% block headerjs %}
6<script type="text/javascript" src="/media/django_nova/js/jquery.form.js"></script>
7{% endblock %}
8
9
10{% block content %}
11 <div id="right_content">
12 <div id="page_head">
13 <h2 id="page_heading">Images</h2>
14 <p id="page_description">Images are snapshots of running systems which can easily be deployed to run one or more instances.</p>
15 </div>
16
17 {% include "django_nova/_messages.html" %}
18
19 {% if images %}
20 <table id="image_launch">
21 <tr>
22 <th>ID</th>
23 <th>Description</th>
24 <th colspan="2">Owner</th>
25 </tr>
26 {% for image in images %}
27 <tr class="{% cycle 'odd' 'even' %}">
28 {% if image.id == ami.id %}
29 <td class="detail_wrapper" colspan="4">
30 <div id="{{ ami.id }}" class="image_detail">
31 <div class="column">
32 <div class="image_detail_item">
33 <span class="label">Owner: </span>
34 <span class="data">{{ ami.ownerId }}</span>
35 </div>
36
37 <div class="image_detail_item">
38 <span class="label">Description: </span>
39 <span class="data">{{ ami.description }}</span>
40 </div>
41
42 <div class="image_detail_item">
43 <span class="label">Location: </span>
44 <span class="data">{{ ami.location }}</span>
45 </div>
46 </div>
47
48 <div class="column">
49 <div class="image_detail_item">
50 <span class="label">ID: </span>
51 <span class="data">{{ ami.id }}</span>
52 </div>
53 <div class="image_detail_item">
54 <span class="label">Name: </span>
55 <span class="data">{% if ami.displayName %}{{ ami.displayName }}{%else%}{{ ami.id }}{% endif %}</span>
56 </div>
57 <div class="image_detail_item">
58 <span class="label">Type: </span>
59 <span class="data">{{ ami.type }}</span>
60 </div>
61 <div class="image_detail_item">
62 <span class="label">Architecture: </span>
63 <span class="data">{{ ami.architecture }}</span>
64 </div>
65 </div>
66
67 <div id="last" class="column">
68 {% if ami.is_public %}
69 <div id="public" class="privacy">Public Image</div>
70 {% else %}
71 <div id="private" class="privacy">Private Image</div>
72 {% endif %}
73
74 <a id="launch_{{ image.id }}" class="launch" href="{% url nova_images_launch project.projectname image.id %}" title="Click to launch image">Launch</a>
75 {% if can_modify or user.username == ami.ownerId %}
76 <a id="edit_image_link" href="{% url nova_images_update project.projectname ami.id %}">Edit Image</a>
77 {% endif %}
78
79 </div>
80
81 {% if can_modify or user.username == ami.ownerId %}
82 <span class="image_privacy">
83 <form id="privacy_{{ ami.id }}" action="{% url nova_images_privacy project.projectname ami.id %}" method="post" accept-charset="utf-8">
84 {% csrf_token %}
85 {% if ami.is_public %}
86 <input class="private" type="submit" value="Make Private" />
87 {% else %}
88 <input class="public" type="submit" value="Make Public" />
89 {% endif %}
90 </form>
91 </span>
92
93 <span class="delete">
94 <form id="delete_{{ ami.id }}" action="{% url nova_images_remove project.projectname ami.id %}" method="post" accept-charset="utf-8">
95 {% csrf_token %}
96 <input type="submit" value="Remove Image" />
97 </form>
98 </span>
99 {% endif %}
100 </div>
101 </td>
102 {% else %}
103 <td class="image_id"><a href="{% url nova_images_detail project.projectname image.id %}">{{ image.id }}</a></td>
104 <td class="image_location odd">
105 {% if image.description %}
106 {{ image.description }}
107 {% else %}
108 {{ image.location }}
109 {% endif %}
110 </td>
111 <td class="image_owner_id">{{ image.ownerId }}</td>
112 <td class="image_launch_btn odd"><a id="launch_{{ image.id }}" class="launch" href="{% url nova_images_launch project.projectname image.id %}">Launch</a></td>
113 {#<td class="odd"><a class="ui-state-default ui-corner-all" onclick="$('#dlg_launch').dialog('open');">Launch</a></td>#}
114 {% endif %}
115 </tr>
116 {% endfor %}
117 </table>
118 {% else %}
119 <div class="ui-widget">
120 <div class="ui-state-highlight ui-corner-all">
121 <p>
122 <span class="ui-icon ui-icon-info"></span>
123 No images currently available.
124 </p>
125 </div>
126 </div>
127 {% endif %}
128 </div>
129
130 <div id="dlg_launch" title="Launch Instance" style="display:none;">
131 <form id="frm_launch" action="url nova_images_launch project.projectname" method="post">
132 {% csrf_token %}
133 {% include "django_nova/images/_launch_form.html" %}
134 </form>
135 </div>
136
137 <div id="dlg_confirm" title="Confirm Termination">
138 <p>Are you sure you wish to unregister the <span id="ami_name"></span> image?</p>
139 </div>
140
141{% endblock %}
142
143{% block footerjs %}
144{{ block.super }}
145<script type="text/javascript">
146 var options = {
147 success: handleResponse,
148 beforeSubmit: showRequest,
149 dataType: 'json'
150 }
151
152 // TODO: On dialog open, reset form and validation.
153 $(function() {
154 $('#dlg_launch').dialog({
155 buttons: {
156 'Ok': function() {
157 $('#frm_launch').ajaxSubmit(options);
158 },
159 'Cancel': function() {
160 $(this).dialog('close');
161 }
162 },
163 autoOpen: false,
164 resizable: false,
165 width: 400,
166 height: 400
167 });
168 });
169
170 function showRequest(formData, jqForm, options) {
171 var queryString = $.param(formData);
172 alert('About to submit: \n\n' + queryString);
173 return true;
174 }
175
176 function handleResponse(data, statusText, xhr, $form) {
177 alert('status: ' + statusText + '\nsuccess:\n\n' + data.success);
178 }
179
180 $(function(){
181 $('.delete form').submit(function() {
182 ami_name = $(this).parent().parent().attr("id");
183 $('#ami_name').text(ami_name);
184 $('#dlg_confirm').dialog('open');
185 return false;
186 });
187
188 $('#dlg_confirm').dialog({
189 buttons: {
190 'Ok': onConfirmOK,
191 'Cancel': function() { $(this).dialog('close'); }
192 },
193 autoOpen: false,
194 resizable: false,
195 width: 500,
196 height: 200
197 });
198 })
199
200 function onConfirmOK() {
201 $(this).dialog('close');
202 form = document.getElementById('delete_' + ami_name);
203 if(form) form.submit();
204 }
205
206</script>
207{% endblock %}
2080
=== removed file 'src/django_nova/templates/django_nova/images/edit.html'
--- src/django_nova/templates/django_nova/images/edit.html 2011-01-16 21:28:02 +0000
+++ src/django_nova/templates/django_nova/images/edit.html 1970-01-01 00:00:00 +0000
@@ -1,35 +0,0 @@
1{% extends "django_nova/images/base.html" %}
2
3{% block title %} - Cloud Computing{% endblock %}
4
5{% block headerjs %}
6<script type="text/javascript" src="{{ COMMON_MEDIA_PREFIX }}js/jquery.form.js"></script>
7{% endblock %}
8
9{% block content %}
10<div id="right_content">
11 <div id="page_head">
12 <h2 id="page_heading">Edit Image</h2>
13 <p id="page_description">From this page you can edit the name and description of an image that belongs to you.</p>
14 </div>
15
16 <div class="dash_block first">
17 <h3 class="image_id">Edit Image: {{ ami.id }}</h3>
18
19 <form class="edit_image" id="rename_{{ ami.id }}" action="{% url nova_images_update project.projectname ami.id %}" method="post">
20 <fieldset>
21 {% csrf_token %}
22 {% for field in form %}
23
24 {{ field.label_tag }}
25 {% if field.errors %}{{ field.errors }}{% endif %}
26 {{ field }}
27 {% endfor %}
28 <input type="submit" value="Update Image" />
29 </fieldset>
30 </form>
31
32 </div>
33</div>
34
35{% endblock %}
360
=== removed file 'src/django_nova/templates/django_nova/images/index.html'
--- src/django_nova/templates/django_nova/images/index.html 2011-01-17 06:58:19 +0000
+++ src/django_nova/templates/django_nova/images/index.html 1970-01-01 00:00:00 +0000
@@ -1,70 +0,0 @@
1{% extends "django_nova/images/base.html" %}
2
3{% block title %} - Launch an Image{% endblock %}
4
5{% block headerjs %}
6<script type="text/javascript" src="/media/django_nova/js/jquery.form.js"></script>
7{% endblock %}
8
9
10{% block content %}
11 <div id="right_content">
12 <div id="page_head">
13 <h2 id="page_heading">Images</h2>
14 <p id="page_description">Images are snapshots of running systems which can easily be deployed to run one or more instances.</p>
15 </div>
16
17 {% include "django_nova/_messages.html" %}
18
19 {% for heading, images in image_lists.items %}
20 {% include "django_nova/images/_list.html" %}
21 {% endfor %}
22
23 </div>
24
25 <div id="dlg_launch" title="Launch Instance" style="display:none;">
26 <form id="frm_launch" action="#" method="post">
27 {% csrf_token %}
28 {% include "django_nova/images/_launch_form.html" %}
29 </form>
30 </div>
31{% endblock %}
32
33{% block footerjs %}
34{{ block.super }}
35<script type="text/javascript">
36 var options = {
37 success: handleResponse,
38 beforeSubmit: showRequest,
39 dataType: 'json'
40 }
41
42 // TODO: On dialog open, reset form and validation.
43 $(function() {
44 $('#dlg_launch').dialog({
45 buttons: {
46 'Ok': function() {
47 $('#frm_launch').ajaxSubmit(options);
48 },
49 'Cancel': function() {
50 $(this).dialog('close');
51 }
52 },
53 autoOpen: false,
54 resizable: false,
55 width: 400,
56 height: 400
57 });
58 });
59
60 function showRequest(formData, jqForm, options) {
61 var queryString = $.param(formData);
62 alert('About to submit: \n\n' + queryString);
63 return true;
64 }
65
66 function handleResponse(data, statusText, xhr, $form) {
67 alert('status: ' + statusText + '\nsuccess:\n\n' + data.success);
68 }
69</script>
70{% endblock %}
710
=== removed file 'src/django_nova/templates/django_nova/images/launch.html'
--- src/django_nova/templates/django_nova/images/launch.html 2011-01-16 21:28:02 +0000
+++ src/django_nova/templates/django_nova/images/launch.html 1970-01-01 00:00:00 +0000
@@ -1,32 +0,0 @@
1{% extends "django_nova/images/base.html" %}
2
3{% block title %} - Cloud Computing{% endblock %}
4
5{% block headerjs %}
6<script type="text/javascript" src="{{ COMMON_MEDIA_PREFIX }}js/jquery.form.js"></script>
7{% endblock %}
8
9{% block content %}
10<div id="right_content">
11 <div id="page_head">
12 <h2 id="page_heading">Launch Image</h2>
13 <p id="page_description">You can launch up to five instances of an image at a time. Some images allow for custom configuration to be passed in via User data. (<a href="/kb/show/UserData/">read more</a>)</p>
14 </div>
15
16 <div class="dash_block first">
17 <form id="frm_launch" action="{% url nova_images_launch project.projectname ami.id %}" method="post">
18 {% csrf_token %}
19 <fieldset>
20 <h3 class="image_id">Launch Image {{ ami.id }}</h3>
21 <div class="even">
22 <label>Location</label>
23 <span class="image_location">{{ ami.location }}</span>
24 </div>
25 {% include "django_nova/images/_launch_form.html" %}
26 <input id="launch_image" type="submit" value="Launch" />
27 </fieldset>
28 </form>
29 </div>
30</div>
31
32{% endblock %}
330
=== removed directory 'src/django_nova/templates/django_nova/instances'
=== removed file 'src/django_nova/templates/django_nova/instances/_instances_list.html'
--- src/django_nova/templates/django_nova/instances/_instances_list.html 2011-01-12 20:02:06 +0000
+++ src/django_nova/templates/django_nova/instances/_instances_list.html 1970-01-01 00:00:00 +0000
@@ -1,104 +0,0 @@
1 {% if instances %}
2 <table style="width: 100%">
3 <tr>
4 <th>ID</th>
5 <th>Image</th>
6 <th>Size</th>
7 <th>IP</th>
8 <th colspan="2">State</th>
9 </tr>
10 {% for instance in instances %}
11 <tr class="{% cycle 'odd' 'even' %}">
12 {% if instance.id == selected_instance.id %}
13 <td class="detail_wrapper" colspan="6">
14 <div id="{{selected_instance.id}}" class="instance_detail">
15 <div class="column">
16 <div class="instance_detail_item">
17 <span class="label">Instance ID: </span>
18 <span class="data">{{ selected_instance.id }}</span>
19 </div>
20 <div class="instance_detail_item">
21 <span class="label">Name: </span>
22 <span class="data">{% if selected_instance.displayName != "" %}{{ selected_instance.displayName }}{% else %} None {% endif %}</span>
23 </div>
24 <div class="instance_detail_item">
25 <span class="label">Description: </span>
26 <span class="data" id="desc">{{ selected_instance.displayDescription }}</span>
27 </div>
28 </div>
29
30 <div class="column">
31 <div class="instance_detail_item">
32 <span class="label">Region: </span>
33 <span class="data">{{ selected_instance.region.name }}</span>
34 </div>
35 <div class="instance_detail_item">
36 <span class="label">Size: </span>
37 <span class="data">{{ selected_instance.instance_type }}</span>
38 </div>
39 <div class="instance_detail_item">
40 <span class="label">State: </span>
41 <span class="data">{{ selected_instance.state }}</span>
42 </div>
43 <div class="instance_detail_item">
44 <span class="label">Image ID: </span>
45 <span class="data">{{ selected_instance.image_id }}</span>
46 </div>
47 <div class="instance_detail_item">
48 <span class="label">IP Address: </span>
49 <span class="data">{{ selected_instance.dns_name }}</span>
50 </div>
51
52 </div>
53
54 <div id="last" class="column">
55 {% if instance.state == "running" %}
56 <a href="{% url nova_instances_console project.projectname instance.id %}" id="console_{{instance.id}}" class="console" target="_blank">Show Console</a>{% endif %}
57 <a id="edit_instance_link" href="{% url nova_instance_update project.projectname instance.id %}">Edit Instance</a>
58
59
60 </div>
61
62 <span class="delete">
63 <form id="form_terminate_{{ instance.id }}" class="form-terminate" method="post" action="{% url nova_instances_terminate project.projectname %}" >
64 <input name="instance_id" type="hidden" value="{{ instance.id }}" />
65 <input id="terminate_{{instance.id}}" class="terminate" type="submit" value="Terminate" />
66 {% csrf_token %}
67 </form>
68 </span>
69
70 </div>
71
72 </td>
73 {% else %}
74
75 <td><a href="{% url nova_instances_detail project.projectname instance.id %}">{{ instance.id }} {% if instance.displayName %}({{ instance.displayName }}){% endif %}
76 </a></td>
77 <td class="odd">{{ instance.image_id }}</td>
78 <td>{{ instance.instance_type }}</td>
79 <td class="odd">{{ instance.dns_name }}</td>
80 <td>{{ instance.state }}</td>
81 <td id="actions" class="odd">
82 <form id="form_terminate_{{ instance.id }}" class="form-terminate" method="post" action="{% url nova_instances_terminate project.projectname %}" >
83 <input name="instance_id" type="hidden" value="{{ instance.id }}" />
84 <input id="terminate_{{instance.id}}" class="terminate" type="submit" value="Terminate" />
85 {% csrf_token %}
86 </form>
87 {% if instance.state == "running" %}
88 <a href="{% url nova_instances_console project.projectname instance.id %}" id="console_{{instance.id}}" class="console" target="_blank">Show Console</a>
89 {% endif %}
90 </td>
91 {% endif %}
92 </tr>
93 {% endfor %}
94 </table>
95 {% else %}
96 <div class="ui-widget">
97 <div class="ui-state-highlight ui-corner-all">
98 <p>
99 <span class="ui-icon ui-icon-info"></span>
100 No instances are currently running. You may start a new instance from the <a href="{% url nova_images project.projectname %}">images</a> tab.
101 </p>
102 </div>
103 </div>
104 {% endif %}
1050
=== removed file 'src/django_nova/templates/django_nova/instances/base.html'
--- src/django_nova/templates/django_nova/instances/base.html 2011-01-17 05:55:41 +0000
+++ src/django_nova/templates/django_nova/instances/base.html 1970-01-01 00:00:00 +0000
@@ -1,7 +0,0 @@
1{% extends "django_nova/base.html" %}
2{% load sidebar_tags %}
3
4{% block nav_projects %}
5 {% sidebar_select instances %}
6 {{ block.super }}
7{% endblock %}
8\ No newline at end of file0\ No newline at end of file
91
=== removed file 'src/django_nova/templates/django_nova/instances/detail_list.html'
--- src/django_nova/templates/django_nova/instances/detail_list.html 2011-01-17 05:55:41 +0000
+++ src/django_nova/templates/django_nova/instances/detail_list.html 1970-01-01 00:00:00 +0000
@@ -1,33 +0,0 @@
1{% extends "django_nova/instances/base.html" %}
2
3{% block title %} - Cloud Computing{% endblock %}
4
5{% block content %}
6
7<div id="right_content">
8 <div id="page_head">
9 <h2 id="page_heading">Instance ID: {{ instance.id }}</h2>
10 <p id="page_description">Here you can see up to the minute performance data about your instance.</p>
11 </div>
12
13 {% include "django_nova/_messages.html" %}
14
15
16 <div class="dash_block first">
17 <h3 class="image_id">Edit Instance: {{ instance.id }}</h3>
18
19 <form class="edit_instance" id="rename_{{ instance.id }}" action="{% url nova_instance_update project.projectname instance.id %}" method="post">
20 <fieldset>
21 {% csrf_token %}
22 {% for field in form %}
23
24 {{ field.label_tag }}
25 {% if field.errors %}{{ field.errors }}{% endif %}
26 {{ field }}
27 {% endfor %}
28 <input type="submit" value="Update Instance" />
29 </fieldset>
30 </form>
31 </div>
32
33{% endblock %}
340
=== removed file 'src/django_nova/templates/django_nova/instances/edit.html'
--- src/django_nova/templates/django_nova/instances/edit.html 2011-01-17 05:55:41 +0000
+++ src/django_nova/templates/django_nova/instances/edit.html 1970-01-01 00:00:00 +0000
@@ -1,34 +0,0 @@
1{% extends "django_nova/instances/base.html" %}
2
3{% block title %} - Cloud Computing{% endblock %}
4
5{% block headerjs %}
6<script type="text/javascript" src="{{ COMMON_MEDIA_PREFIX }}js/jquery.form.js"></script>
7{% endblock %}
8
9{% block content %}
10<div id="right_content">
11 <div id="page_head">
12 <h2 id="page_heading">Edit Instance</h2>
13 <p id="page_description">From this page you can give your instance an alias, so you don't have to remember its unique id.</p>
14 </div>
15
16 <div class="dash_block first">
17 <h3 class="image_id">Edit Instance: {{ instance.id }}</h3>
18
19 <form class="edit_instance" id="rename_{{ selected_instance.id }}" action="{% url nova_instance_update project.projectname instance.id %}" method="post">
20 <fieldset>
21 {% csrf_token %}
22 {% for field in update_form %}
23
24 {{ field.label_tag }}
25 {% if field.errors %}{{ field.errors }}{% endif %}
26 {{ field }}
27 {% endfor %}
28 <input type="submit" value="Update Instance" />
29 </fieldset>
30 </form>
31 </div>
32</div>
33
34{% endblock %}
350
=== removed file 'src/django_nova/templates/django_nova/instances/index.html'
--- src/django_nova/templates/django_nova/instances/index.html 2011-02-27 21:52:13 +0000
+++ src/django_nova/templates/django_nova/instances/index.html 1970-01-01 00:00:00 +0000
@@ -1,98 +0,0 @@
1{% extends "django_nova/instances/base.html" %}
2
3{% block title %} - {{ project.projectname|capfirst }} Instances{% endblock %}
4{% block pageclass %}instances{% endblock %}
5
6{% block content %}
7 <div id="page_head">
8 <div id="spinner"></div>
9
10 <h2 id="page_heading">Instances</h2>
11 <p id="page_description">Instances are virtual servers launched from images. You can launch instances from the <a href="{% url nova_images project.projectname %}">images tab</a>.</p>
12 </div>
13
14 {% include "django_nova/_messages.html" %}
15
16 <div id="instances">
17 {% include "django_nova/instances/_instances_list.html" %}
18 </div>
19