~ubuntu-branches/ubuntu/utopic/maas/utopic-security

« back to all changes in this revision

Viewing changes to src/maasserver/models/bootsourceselection.py

  • Committer: Package Import Robot
  • Author(s): Julian Edwards, Julian Edwards, Andres Rodriguez
  • Date: 2014-08-21 18:38:27 UTC
  • mfrom: (1.2.34)
  • Revision ID: package-import@ubuntu.com-20140821183827-9xyb5u2o4l8g3zxj
Tags: 1.6.1+bzr2550-0ubuntu1
* New upstream bugfix release:
  - Auto-link node MACs to Networks (LP: #1341619)

[ Julian Edwards ]
* debian/maas-region-controller.postinst: Don't restart RabbitMQ on
  upgrades, just ensure it's running.  Should prevent a race with the
  cluster celery restarting.
* debian/rules: Pull upstream branch from the right place.

[ Andres Rodriguez ]
* debian/maas-region-controller.postinst: Ensure cluster celery is
  started if it also runs on the region.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright 2014 Canonical Ltd.  This software is licensed under the
 
2
# GNU Affero General Public License version 3 (see the file LICENSE).
 
3
 
 
4
"""Model for filtering a selection of boot resources."""
 
5
 
 
6
from __future__ import (
 
7
    absolute_import,
 
8
    print_function,
 
9
    unicode_literals,
 
10
    )
 
11
 
 
12
str = None
 
13
 
 
14
__metaclass__ = type
 
15
__all__ = [
 
16
    'BootSourceSelection',
 
17
    ]
 
18
 
 
19
 
 
20
from django.db.models import (
 
21
    CharField,
 
22
    ForeignKey,
 
23
    Manager,
 
24
    )
 
25
import djorm_pgarray.fields
 
26
from maasserver import DefaultMeta
 
27
from maasserver.models.cleansave import CleanSave
 
28
from maasserver.models.timestampedmodel import TimestampedModel
 
29
 
 
30
 
 
31
class BootSourceSelectionManager(Manager):
 
32
    """Manager for `BootSourceSelection` class."""
 
33
 
 
34
 
 
35
class BootSourceSelection(CleanSave, TimestampedModel):
 
36
    """A set of selections for a single `BootSource`."""
 
37
 
 
38
    class Meta(DefaultMeta):
 
39
        """Needed for South to recognize this model."""
 
40
 
 
41
    objects = BootSourceSelectionManager()
 
42
 
 
43
    boot_source = ForeignKey('maasserver.BootSource', blank=False)
 
44
 
 
45
    release = CharField(
 
46
        max_length=20, blank=True, default='',
 
47
        help_text="The Ubuntu release for which to import resources.")
 
48
 
 
49
    arches = djorm_pgarray.fields.ArrayField(dbtype="text")
 
50
 
 
51
    subarches = djorm_pgarray.fields.ArrayField(dbtype="text")
 
52
 
 
53
    labels = djorm_pgarray.fields.ArrayField(dbtype="text")
 
54
 
 
55
    def to_dict(self):
 
56
        """Return the current `BootSourceSelection` as a dict."""
 
57
        return {
 
58
            "release": self.release,
 
59
            "arches": self.arches,
 
60
            "subarches": self.subarches,
 
61
            "labels": self.labels,
 
62
            }