~ubuntu-branches/ubuntu/precise/maas/precise-security

« back to all changes in this revision

Viewing changes to src/maasserver/views.py

  • Committer: Package Import Robot
  • Author(s): Andres Rodriguez, Scott Moser, Andres Rodriguez, Dave Walker (Daviey), Gavin Panella
  • Date: 2012-04-12 16:46:22 UTC
  • mfrom: (1.1.11)
  • Revision ID: package-import@ubuntu.com-20120412164622-u1qnsq0s9tsc2f14
Tags: 0.1+bzr462+dfsg-0ubuntu1
* New upstream release (LP: #980240)

[ Scott Moser ]
* add dependency on distro-info (LP: #949442)
* debian/control: add dependency on tgt for ephemeral iscsi environment

[ Andres Rodriguez ]
* Make package lintian clean:
  - maas{-dhcp}.lintian-overrides: Add to make lintian clean.
  - debian/control: Add missing dependencies; correct section and desc.
  - debian/maas.postinst: Do not use absolute path for rabbitmqctl.
  - debian/patches: Add headers to all patches.
* debian/maas-dhcp.postrm: Added to disable dnsmasq in cobbler on removal.
* debian/maas.config: Do not set a password with pwgen as it is not an
  essential package; allow dbconfig-common to create a password instead by
  creating an empty question. (LP: #977475)
* Run MAAS, pserv, txlongpoll as non-root user. (LP: #975436)
  - debian/maas.postinst: Create user/group; set correct permissions for
    directories.
  - debian/maas.postrm: Remove user/group; restart apache2.
  - debian/maas.maas-{pserv,txlongpoll}.upstart: Update to run as non-root
    'maas' user.
* debian/patches/01-fix-database-settings.patch: Remove adding of PSERV_URL.
* debian/maas.postinst:
  - Handle config file upgrade from versions lower than 0.1+bzr445+dfsg-0ubuntu1,
    by creating new passwords and updating accordingly
  - use local variables in functions.
  - Handle maas tgt configuration for upgrades from 0.1+bzr459+dfsg-0ubuntu1.
* debian/extras/99-maas: Add squid-deb-proxy file to enable PPAs. (LP: #979383)
* debian/maas.install: Install missing commissioning-user-data script.

[ Dave Walker (Daviey) ]
* debian/patches/02-pserv-config.patch: Refreshed to apply to updated config.

[ Gavin Panella ]
* debian/maas.postinst: Update pserv.yaml and maas_local_settings.py to use
  password.

Show diffs side-by-side

added added

removed removed

Lines of Context:
31
31
import mimetypes
32
32
import os
33
33
import urllib2
 
34
from django.utils.safestring import mark_safe
34
35
 
35
36
from convoy.combo import (
36
37
    combine_files,
110
111
    return dj_logout(request, next_page=reverse('login'))
111
112
 
112
113
 
 
114
# Info message displayed on the node page for COMMISSIONING
 
115
# or READY nodes.
 
116
NODE_BOOT_INFO = mark_safe("""
 
117
You can boot this node using Avahi enabled boot media or an
 
118
adequately configured dhcp server, see
 
119
<a href="https://wiki.ubuntu.com/ServerTeam/MAAS/AvahiBoot">
 
120
https://wiki.ubuntu.com/ServerTeam/MAAS/AvahiBoot</a> for
 
121
details.
 
122
""")
 
123
 
 
124
 
113
125
class NodeView(UpdateView):
114
126
 
115
127
    template_name = 'maasserver/node_view.html'
124
136
        return node
125
137
 
126
138
    def get_form_class(self):
127
 
        return get_action_form(self.request.user)
 
139
        return get_action_form(self.request.user, self.request)
128
140
 
129
141
    def get_context_data(self, **kwargs):
130
142
        context = super(NodeView, self).get_context_data(**kwargs)
133
145
            NODE_PERMISSION.EDIT, node)
134
146
        context['can_delete'] = self.request.user.has_perm(
135
147
            NODE_PERMISSION.ADMIN, node)
 
148
        if node.status in (NODE_STATUS.COMMISSIONING, NODE_STATUS.READY):
 
149
            messages.info(self.request, NODE_BOOT_INFO)
136
150
        return context
137
151
 
138
152
    def get_success_url(self):
205
219
    context_object_name = "node_list"
206
220
 
207
221
    def get_queryset(self):
 
222
        # Return node list sorted, newest first.
208
223
        return Node.objects.get_nodes(
209
 
            user=self.request.user, perm=NODE_PERMISSION.VIEW)
 
224
            user=self.request.user,
 
225
            perm=NODE_PERMISSION.VIEW).order_by('-id')
210
226
 
211
227
    def get_context_data(self, **kwargs):
212
228
        context = super(NodeListView, self).get_context_data(**kwargs)