Merge lp:~hopem/maas-deployer/lp1491443 into lp:~maas-deployers/maas-deployer/next

Proposed by Edward Hope-Morley
Status: Merged
Merged at revision: 30
Proposed branch: lp:~hopem/maas-deployer/lp1491443
Merge into: lp:~maas-deployers/maas-deployer/next
Diff against target: 90 lines (+19/-7)
4 files modified
maas_deployer/cli.py (+2/-0)
maas_deployer/vmaas/engine.py (+8/-7)
maas_deployer/vmaas/exception.py (+5/-0)
maas_deployer/vmaas/maasclient/driver.py (+4/-0)
To merge this branch: bzr merge lp:~hopem/maas-deployer/lp1491443
Reviewer Review Type Date Requested Status
Ante Karamatić (community) Approve
Review via email: mp+269928@code.launchpad.net
To post a comment you must log in.
Revision history for this message
Ante Karamatić (ivoks) wrote :

Why don't we do a switch 'fail on error', instead of catching every maas call that we should fail on?

Revision history for this message
Edward Hope-Morley (hopem) wrote :

I think we can look into that for the next release. If we implement that kind of logic we have to take a close look at the code to make sure we don't get false positives etc. Basically i think to get that right it will be nontrivial so lets punt it to 0.0.3

Revision history for this message
Ante Karamatić (ivoks) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'maas_deployer/cli.py'
2--- maas_deployer/cli.py 2015-08-14 09:16:18 +0000
3+++ maas_deployer/cli.py 2015-09-02 14:34:04 +0000
4@@ -87,6 +87,8 @@
5 engine = DeploymentEngine(config, target)
6 engine.deploy(target)
7 except:
8+ # Remove console handler to avoid displaying the exception twice
9+ log.removeHandler(handler)
10 log.exception("MAAS deployment failed.")
11 raise
12 else:
13
14=== modified file 'maas_deployer/vmaas/engine.py'
15--- maas_deployer/vmaas/engine.py 2015-09-01 23:15:07 +0000
16+++ maas_deployer/vmaas/engine.py 2015-09-02 14:34:04 +0000
17@@ -14,13 +14,14 @@
18
19 from subprocess import CalledProcessError
20
21-
22 from maas_deployer.vmaas import (
23 vm,
24 util,
25 template,
26 )
27-
28+from maas_deployer.vmaas.exception import (
29+ MAASDeployerClientError,
30+)
31 from maas_deployer.vmaas.maasclient import (
32 bootimages,
33 MAASClient,
34@@ -417,8 +418,8 @@
35 node_group_interfaces = copy.deepcopy(maas_config['node_group_ifaces'])
36 for iface in node_group_interfaces:
37 if not self.create_nodegroup_interface(client, nodegroup, iface):
38- log.warning("Unable to create nodegroup interface: %s",
39- iface)
40+ msg = "Unable to create nodegroup interface: %s" % iface
41+ raise MAASDeployerClientError(msg)
42
43 nodes = maas_config.get('nodes', [])
44 self._create_maas_nodes(client, nodes)
45@@ -461,14 +462,14 @@
46 juju_node = self._get_juju_nodename(nodes)
47 if juju_node is not None and not virsh_info:
48 try:
49- _, stderr = util.virsh(['start', juju_node])
50+ util.virsh(['start', juju_node])
51 except CalledProcessError as exc:
52 # Ignore already started error
53 msg = 'Domain is already active'
54 if msg not in exc.output:
55 raise
56- else:
57- log.debug(msg)
58+
59+ log.debug(msg)
60
61 self._wait_for_nodes_to_commission(client)
62 self._claim_sticky_ip_address(client, maas_config)
63
64=== modified file 'maas_deployer/vmaas/exception.py'
65--- maas_deployer/vmaas/exception.py 2015-08-11 22:28:00 +0000
66+++ maas_deployer/vmaas/exception.py 2015-09-02 14:34:04 +0000
67@@ -30,3 +30,8 @@
68 "running the deployer" % (pool))
69
70 super(MAASDeployerPoolNotFound, self).__init__(msg)
71+
72+
73+class MAASDeployerClientError(MAASDeployerBaseException):
74+ def __init__(self, msg):
75+ super(MAASDeployerClientError, self).__init__(msg)
76
77=== modified file 'maas_deployer/vmaas/maasclient/driver.py'
78--- maas_deployer/vmaas/maasclient/driver.py 2015-07-23 16:20:28 +0000
79+++ maas_deployer/vmaas/maasclient/driver.py 2015-09-02 14:34:04 +0000
80@@ -11,6 +11,10 @@
81 self.ok = ok
82 self.data = data
83
84+ def __nonzero__(self):
85+ """Allow boolean comparison"""
86+ return bool(self.ok)
87+
88
89 class MAASDriver(object):
90 """

Subscribers

People subscribed via source and target branches