← Back to team overview

launchpad-reviewers team mailing list archive

[Merge] lp:~jtv/maas/non-cobbler-power-types into lp:maas

 

Jeroen T. Vermeulen has proposed merging lp:~jtv/maas/non-cobbler-power-types into lp:maas.

Requested reviews:
  Launchpad code reviewers (launchpad-reviewers)

For more details, see:
https://code.launchpad.net/~jtv/maas/non-cobbler-power-types/+merge/106606

I hope this will fix the build.  Tests pass locally, but Jenkins records failures about the test that iterates over POWER_TYPE using unknown power methods.

This change incorporates the list of known power methods that Cobbler gives in that error, and restricts the test to those.  Hopefully that will suppress the error.  Yes, it's brittle but we're not planning to keep Cobbler around anyway.

I haven't been able to test this locally; I had some trouble getting vdenv to work.  But it probably won't break the build any worse than it already is (it's been broken in various ways all day).

You may notice that I use the terms “power type” and “power method” more or less interchangeably.  That practice originates in Cobbler itself.  I generally speak of power methods, but refer to power types in the code.  Once we drop Cobbler, very little of this will matter.  If it bugs us then, we can make a one-off sweep to make it consistent.


Jeroen
-- 
https://code.launchpad.net/~jtv/maas/non-cobbler-power-types/+merge/106606
Your team Launchpad code reviewers is requested to review the proposed merge of lp:~jtv/maas/non-cobbler-power-types into lp:maas.
=== modified file 'src/provisioningserver/tests/test_api.py'
--- src/provisioningserver/tests/test_api.py	2012-04-30 16:26:38 +0000
+++ src/provisioningserver/tests/test_api.py	2012-05-21 10:26:21 +0000
@@ -586,10 +586,13 @@
 class ProvisioningAPITestsWithCobbler:
     """Provisioning API tests that also access a real, or fake, Cobbler."""
 
+    # Overridable: acceptable power types in the current test setup.
+    valid_power_types = set(map_enum(POWER_TYPE).values())
+
     @inlineCallbacks
     def test_add_node_sets_power_type(self):
         papi = self.get_provisioning_api()
-        power_types = list(map_enum(POWER_TYPE).values())
+        power_types = self.valid_power_types.copy()
         # The DEFAULT value does not exist as far as the provisioning
         # server is concerned.
         power_types.remove(POWER_TYPE.DEFAULT)
@@ -746,6 +749,28 @@
 
     real_cobbler = RealCobbler()
 
+    # Power methods that Cobbler accepts.
+    cobbler_power_types = set([
+        'apc_snmp',
+        'bladecenter',
+        'bullpap',
+        'drac',
+        'ether_wake',
+        'ilo',
+        'integrity',
+        'ipmilan',
+        'ipmitool',
+        'lpar',
+        'rsa',
+        'sentryswitch_cdu',
+        'virsh',
+        'wti',
+        ])
+    # Only accept power methods that both MAAS and Cobbler know.
+    valid_power_types = (
+        ProvisioningAPITestsWithCobbler.valid_power_types.intersection(
+            cobbler_power_types))
+
     @real_cobbler.skip_unless_available
     def get_provisioning_api(self):
         """Return a connected :class:`ProvisioningAPI`."""