Merge lp:~rvb/maas/migr-bug-1302156-1.5 into lp:maas/1.5

Proposed by Raphaël Badin
Status: Merged
Approved by: Raphaël Badin
Approved revision: no longer in the source branch.
Merged at revision: 2231
Proposed branch: lp:~rvb/maas/migr-bug-1302156-1.5
Merge into: lp:maas/1.5
Diff against target: 40 lines (+16/-7)
1 file modified
src/maasserver/migrations/0072_remove_ipmi_autodetect.py (+16/-7)
To merge this branch: bzr merge lp:~rvb/maas/migr-bug-1302156-1.5
Reviewer Review Type Date Requested Status
Raphaël Badin (community) Approve
Review via email: mp+214732@code.launchpad.net

Commit message

Backport revision 2244: A 'damage control' branch: if 0072_remove_ipmi_autodetect fails, do not take the whole package down with it.

To post a comment you must log in.
Revision history for this message
Raphaël Badin (rvb) wrote :

Simple backport: self-approving.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/maasserver/migrations/0072_remove_ipmi_autodetect.py'
--- src/maasserver/migrations/0072_remove_ipmi_autodetect.py 2014-03-27 04:15:45 +0000
+++ src/maasserver/migrations/0072_remove_ipmi_autodetect.py 2014-04-08 12:14:52 +0000
@@ -1,9 +1,8 @@
1from django.db import models
2from provisioningserver.power_schema import IPMI_DRIVER1from provisioningserver.power_schema import IPMI_DRIVER
3from south.db import db
4# -*- coding: utf-8 -*-2# -*- coding: utf-8 -*-
5from south.utils import datetime_utils as datetime
6from south.v2 import DataMigration3from south.v2 import DataMigration
4from django.db.utils import ProgrammingError
5from maasserver import logger
76
87
9class Migration(DataMigration):8class Migration(DataMigration):
@@ -12,10 +11,20 @@
12 """Change IPMI nodes with default power_driver to LAN 2.0."""11 """Change IPMI nodes with default power_driver to LAN 2.0."""
13 ipmi_nodes = orm['maasserver.Node'].objects.filter(power_type=u'ipmi')12 ipmi_nodes = orm['maasserver.Node'].objects.filter(power_type=u'ipmi')
14 for node in ipmi_nodes:13 for node in ipmi_nodes:
15 if node.power_parameters.get('power_driver') != '':14 if node.power_parameters.get('power_driver') == IPMI_DRIVER.DEFAULT:
16 continue15 node.power_parameters['power_driver'] = IPMI_DRIVER.LAN_2_0
17 node.power_parameters['power_driver'] = IPMI_DRIVER.LAN_2_016 try:
18 node.save() 17 node.save()
18 except ProgrammingError:
19 # We catch django.db.utils.ProgrammingError here because of
20 # the failure described on bug 1302156. Although we didn't
21 # manage to recreate the failure in a controlled environment,
22 # this try/except statement will prevent the migration from
23 # crashing if the failure reappears.
24 logger.exception(
25 "Failed to apply migration 0072_remove_ipmi_autodetect. "
26 "See bug 1302156 "
27 "(https://bugs.launchpad.net/maas/+bug/1302156).")
1928
20 def backwards(self, orm):29 def backwards(self, orm):
21 """LAN 2.0 is valid either way, no need for backwards migration."""30 """LAN 2.0 is valid either way, no need for backwards migration."""

Subscribers

People subscribed via source and target branches

to all changes: