~ubuntu-branches/ubuntu/raring/maas/raring-updates

« back to all changes in this revision

Viewing changes to src/maasserver/enum.py

  • Committer: Package Import Robot
  • Author(s): Andres Rodriguez
  • Date: 2012-07-03 17:42:37 UTC
  • mfrom: (1.1.13)
  • Revision ID: package-import@ubuntu.com-20120703174237-p8l0keuuznfg721k
Tags: 0.1+bzr709+dfsg-0ubuntu1
* New Upstream release
* debian/control:
  - Depends on python-celery, python-tempita, libjs-yui3-{full,min},
    libjs-raphael
* debian/maas.install:
  - Install apiclient, celeryconfig.py, maas-import-pxe-files, preseeds_v2.
  - Update to install various files from chroot, rather tha manually copy
    them from the source.
* debian/maas.links: symlink celeryconfig.py
* debian/maas.maas-celery.upstart: Add job.
* debian/rules:
  - Install celery upstart job.
  - Do not install jslibs as packages are now used.
  - Drop copying of maas_local_settings_sample.py as source now ships
    a maas_local_settings.py
* debian/patches:
  - 04-maas-http-fix.patch: Drop. Merged upstream.
  - 01-fix-database-settings.patch: Refreshed.
  - 99_enums_js.patch: Added until creation of enum.js / build process
    is fixed.
* debian/maas.postinst: Update bzr version to correctly handle upgrades.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# Copyright 2012 Canonical Ltd.  This software is licensed under the
 
2
# GNU Affero General Public License version 3 (see the file LICENSE).
 
3
 
 
4
"""Enumerations meaningful to the maasserver application."""
 
5
 
 
6
from __future__ import (
 
7
    absolute_import,
 
8
    print_function,
 
9
    unicode_literals,
 
10
    )
 
11
 
 
12
__metaclass__ = type
 
13
__all__ = [
 
14
    'ARCHITECTURE',
 
15
    'ARCHITECTURE_CHOICES',
 
16
    'NODE_PERMISSION',
 
17
    'NODE_STATUS',
 
18
    'NODE_STATUS_CHOICES',
 
19
    'NODE_STATUS_CHOICES_DICT',
 
20
    'PRESEED_TYPE',
 
21
    ]
 
22
 
 
23
from collections import OrderedDict
 
24
 
 
25
 
 
26
class NODE_STATUS:
 
27
    """The vocabulary of a `Node`'s possible statuses."""
 
28
    # A node starts out as READY.
 
29
    DEFAULT_STATUS = 0
 
30
 
 
31
    #: The node has been created and has a system ID assigned to it.
 
32
    DECLARED = 0
 
33
    #: Testing and other commissioning steps are taking place.
 
34
    COMMISSIONING = 1
 
35
    #: Smoke or burn-in testing has a found a problem.
 
36
    FAILED_TESTS = 2
 
37
    #: The node can't be contacted.
 
38
    MISSING = 3
 
39
    #: The node is in the general pool ready to be deployed.
 
40
    READY = 4
 
41
    #: The node is ready for named deployment.
 
42
    RESERVED = 5
 
43
    #: The node is powering a service from a charm or is ready for use with
 
44
    #: a fresh Ubuntu install.
 
45
    ALLOCATED = 6
 
46
    #: The node has been removed from service manually until an admin
 
47
    #: overrides the retirement.
 
48
    RETIRED = 7
 
49
 
 
50
 
 
51
# Django choices for NODE_STATUS: sequence of tuples (key, UI
 
52
# representation).
 
53
NODE_STATUS_CHOICES = (
 
54
    (NODE_STATUS.DECLARED, "Declared"),
 
55
    (NODE_STATUS.COMMISSIONING, "Commissioning"),
 
56
    (NODE_STATUS.FAILED_TESTS, "Failed tests"),
 
57
    (NODE_STATUS.MISSING, "Missing"),
 
58
    (NODE_STATUS.READY, "Ready"),
 
59
    (NODE_STATUS.RESERVED, "Reserved"),
 
60
    (NODE_STATUS.ALLOCATED, "Allocated"),
 
61
    (NODE_STATUS.RETIRED, "Retired"),
 
62
)
 
63
 
 
64
 
 
65
NODE_STATUS_CHOICES_DICT = OrderedDict(NODE_STATUS_CHOICES)
 
66
 
 
67
 
 
68
class NODE_AFTER_COMMISSIONING_ACTION:
 
69
    """The vocabulary of a `Node`'s possible value for its field
 
70
    after_commissioning_action.
 
71
 
 
72
    """
 
73
# TODO: document this when it's stabilized.
 
74
    #:
 
75
    DEFAULT = 0
 
76
    #:
 
77
    QUEUE = 0
 
78
    #:
 
79
    #CHECK = 1
 
80
    #:
 
81
    #DEPLOY_12_04 = 2
 
82
 
 
83
 
 
84
NODE_AFTER_COMMISSIONING_ACTION_CHOICES = (
 
85
    (NODE_AFTER_COMMISSIONING_ACTION.QUEUE,
 
86
        "Queue for dynamic allocation to services"),
 
87
    #(NODE_AFTER_COMMISSIONING_ACTION.CHECK,
 
88
    #    "Check compatibility and hold for future decision"),
 
89
    #(NODE_AFTER_COMMISSIONING_ACTION.DEPLOY_12_04,
 
90
    #    "Deploy with Ubuntu 12.04 LTS"),
 
91
)
 
92
 
 
93
 
 
94
NODE_AFTER_COMMISSIONING_ACTION_CHOICES_DICT = dict(
 
95
    NODE_AFTER_COMMISSIONING_ACTION_CHOICES)
 
96
 
 
97
 
 
98
class ARCHITECTURE:
 
99
    """List of supported architectures."""
 
100
    #:
 
101
    i386 = 'i386'
 
102
    #:
 
103
    amd64 = 'amd64'
 
104
 
 
105
 
 
106
# Architecture names.
 
107
ARCHITECTURE_CHOICES = (
 
108
    (ARCHITECTURE.i386, "i386"),
 
109
    (ARCHITECTURE.amd64, "amd64"),
 
110
)
 
111
 
 
112
 
 
113
class NODE_PERMISSION:
 
114
    """Permissions relating to nodes."""
 
115
    VIEW = 'view_node'
 
116
    EDIT = 'edit_node'
 
117
    ADMIN = 'admin_node'
 
118
 
 
119
 
 
120
class PRESEED_TYPE:
 
121
    """Types of preseed documents that can be generated."""
 
122
    DEFAULT = ''
 
123
    COMMISSIONING = 'commissioning'
 
124
    ENLIST = 'enlist'