~ubuntu-branches/ubuntu/saucy/maas/saucy-updates

« back to all changes in this revision

Viewing changes to src/maasserver/tests/test_start_up.py

  • Committer: Package Import Robot
  • Author(s): Andres Rodriguez, Julian Edwards, Raphaël Badin, Jeroen Vermeulen, Andres Rodriguez, Robie Basak, Scott Moser, Diogo Matsubara
  • Date: 2012-10-08 13:10:23 UTC
  • mfrom: (1.1.18)
  • mto: This revision was merged to the branch mainline in revision 21.
  • Revision ID: package-import@ubuntu.com-20121008131023-68glibh0pbqrgtfq
Tags: 0.1+bzr1223+dfsg-0ubuntu1
* New upstream release. (LP: #1062518)

[ Julian Edwards ]
* Split packaging of 'maas' into maas-{region,cluster}-controller
  - debian/control: Update accordingly.
  - debian/*.install: Move files accordingly
  - debian/*.{postinst,postrm,preinst}: Move files accordingly.
* Ensure isc-dhcp-server is disabled when installing maas-dhcp.
* Ensure maas-dns creates the maas user before trying to chown files.
* Make maas-cluster-controller autoconfigure itself when upgrading from the
  old maas package. (LP: #1059416)
* Add missing prerm file for maas-cluster-controller so that .pyc files
  are cleaned up. (LP: #1059973)

[ Raphaël Badin ]
* Install maas_local_celeryconfig.py in /etc/maas and symlink to
  /usr/share/maas.
* debian/maas.postinst: Create rabbitmq celery user/vhost.
* debian/maas.postinst: Update BROKER_URL in maas_local_celeryconfig.py.
* Use maas_local_celeryconfig_cluster.py as the local celery
  configuration file for the cluster worker.
* debian/maas-region-controller.maas-region-celery.upstart: Add region
  worker upstart script.
* Rename cluster worker upstart script into
  maas-cluster-controller.maas-clluster-celery.upstart.
* maas-cluster-controller.maas-celery.upstart: use "celeryconfig_cluster"
  as the Celery config module.
* debian/maas-common.install: Install celeryconfig_common.py.
* debian/maas-cluster-controller.install: Install celeryconfig_cluster.py.
* debian/maas-region-controller.install: Install celeryconfig.py.
* Split celery config into cluster and region configs.
* Add region celeryd upstart config.
* Define CELERY_CONFIG_MODULE in
  maas-cluster-controller.maas-cluster-celery.upstart

[ Jeroen Vermeulen ]
* Make maas_local_celery_config.py non-world readable.
* Make maas_local_celeryconfig_cluster.py non-world readable.
* Set root:maas ownership of local cluster config only *after*
  the maas user/group have been created

[ Andres Rodriguez ]
* debian/maas.postinst:
  - Always restart apache2.
  - Handle upgrades for new upstream release.
  - Handle upgrades for celery rabbitmq worker.
* Add binary package to install client tool.
  - debian/extras/maas-cli: Add binary.
  - debian/maas-cli.install: Add. Install maascli and apiclient.
  - debian/control: Add binary package.
* debian/control:
  - Depends on freeipmi-tools instead of ipmitool.
  - Conflicts/Replaces on maas for python-maas-client.
  - Depends on python-netifaces, python-lxml.
* Add python-maas-client binary package:
  - debian/python-maas-client.install: Add. Install 'apiclient' python module.
  - debian/control: Add package. python-django-maas and maas-cli now
    Depend on it.
* debian/rules: Install maas-dhcp-server upstart job.
* debian/maas.postrm: Remove celery worker rabbitmq user and host.
* debian/extras/99-maas-sudoers: Add for maas-dhcp-server upstart job
  instead of isc-dhcp-server (LP: #1055951)
* debian/maas-region-controller.postinst: Cleanup upgrade rules.
* debian/maas-cluster-controller.postinst: Fix 'local' usage.
* debian/maas-common.install: Install celeryconfig in appropriate location.
* debian/maas-cluster-controller.postrm: Add and delete maas user.
* debian/maas-dhcp.postinst: Stop isc-dhcp-server not isc_dhcp_server.
* debian/maas-region-controller.postinst:
  - Always update passwords on upgrade. No longer check versioning. (LP: #1060094).
  - Add MAAS server to allowed mirror in squid-deb-proxy
  - Source dbconfig conf file for maas-region-controller on upgrade because
    it writes a new config file and no longer preservers the previous password.
* debian/maas-cluster-controller.maas-cluster-celery.upstart: Remove set{uid/gid}.
* debian/maas-region-controller.install: Install maas-import-squashfs
* Handle removal of non existant files (LP: #1059556):
  - debian/maintscript: Added to handle removal of conffiles.
  - debian/control: Add Pre-depends and bump debhelper version.
* update po files for the templates.
* debian/extras/99-maas: Install in usr/share/maas/conf and symlink to the
  appropriate etc dir.
* debian/maas-cluster-controller.config: Source debconf at the beginning of the
  script. (LP: #1063857)
* debian/patches/99-temporary-fix-constraints.patch: Fix constraints maaping
  when deploying with juju. Temporary until it gets merged upstream

[ Robie Basak ]
* Add maas-cluster-controller dependency on uuid-runtime, needed for uuidgen
  by postinst.

[ Scott Moser ]
* debian/maas-dhcp.{install,apparmor,postrm} install apparmor profile into
  /etc/apparmor.d/dhcpd.d (LP: #1049177), and update apparmor profile for
  /usr/sbin/dhcpd on install/remove
* get the ip address for the dhcp server in config

[ Diogo Matsubara ]
* Add initial tests to be run by autotests:
  - debian/control: XS-Testsuite: autopkgtest
  - debian/tests/control: Add
  - debian/tests/maas-package-test: Add
  - tests/maas-integration.py: Add

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
    LockTimeout,
23
23
    )
24
24
from maasserver import start_up
25
 
from maasserver.models.nodegroup import NodeGroup
 
25
from maasserver.components import (
 
26
    discard_persistent_error,
 
27
    register_persistent_error,
 
28
    )
 
29
from maasserver.enum import COMPONENT
 
30
from maasserver.models import (
 
31
    BootImage,
 
32
    NodeGroup,
 
33
    )
 
34
from maasserver.testing.factory import factory
26
35
from maastesting.celery import CeleryFixture
27
36
from maastesting.fakemethod import FakeMethod
28
37
from maastesting.testcase import TestCase
64
73
 
65
74
    def test_start_up_refreshes_workers(self):
66
75
        patched_handlers = tasks.refresh_functions.copy()
67
 
        patched_handlers['nodegroup_name'] = Mock()
 
76
        patched_handlers['nodegroup_uuid'] = Mock()
68
77
        self.patch(tasks, 'refresh_functions', patched_handlers)
69
78
        start_up.start_up()
70
 
        patched_handlers['nodegroup_name'].assert_called_once_with(
71
 
            NodeGroup.objects.ensure_master().name)
 
79
        patched_handlers['nodegroup_uuid'].assert_called_once_with(
 
80
            NodeGroup.objects.ensure_master().uuid)
72
81
 
73
82
    def test_start_up_runs_in_exclusion(self):
74
83
        called = Value('b', False)
97
106
 
98
107
        self.assertRaises(LockTimeout, start_up.start_up)
99
108
        self.assertEqual(0, recorder.call_count)
 
109
 
 
110
    def test_start_up_warns_about_missing_boot_images(self):
 
111
        # If no boot images have been registered yet, that may mean that
 
112
        # the import script has not been successfully run yet, or that
 
113
        # the master worker is having trouble reporting its images.  And
 
114
        # so start_up registers a persistent warning about this.
 
115
        BootImage.objects.all().delete()
 
116
        discard_persistent_error(COMPONENT.IMPORT_PXE_FILES)
 
117
        recorder = self.patch(start_up, 'register_persistent_error')
 
118
 
 
119
        start_up.start_up()
 
120
 
 
121
        self.assertIn(
 
122
            COMPONENT.IMPORT_PXE_FILES,
 
123
            [args[0][0] for args in recorder.call_args_list])
 
124
 
 
125
    def test_start_up_does_not_warn_if_boot_images_are_known(self):
 
126
        # If boot images are known, there is no warning about the import
 
127
        # script.
 
128
        factory.make_boot_image()
 
129
        recorder = self.patch(start_up, 'register_persistent_error')
 
130
 
 
131
        start_up.start_up()
 
132
 
 
133
        self.assertNotIn(
 
134
            COMPONENT.IMPORT_PXE_FILES,
 
135
            [args[0][0] for args in recorder.call_args_list])
 
136
 
 
137
    def test_start_up_does_not_warn_if_already_warning(self):
 
138
        # If there already is a warning about missing boot images, it is
 
139
        # based on more precise knowledge of whether we ever heard from
 
140
        # the region worker at all.  It will not be replaced by a less
 
141
        # knowledgeable warning.
 
142
        BootImage.objects.all().delete()
 
143
        register_persistent_error(
 
144
            COMPONENT.IMPORT_PXE_FILES, factory.getRandomString())
 
145
        recorder = self.patch(start_up, 'register_persistent_error')
 
146
 
 
147
        start_up.start_up()
 
148
 
 
149
        self.assertNotIn(
 
150
            COMPONENT.IMPORT_PXE_FILES,
 
151
            [args[0][0] for args in recorder.call_args_list])