Skip to content

Commit f0fd45f

Browse files
committed
If CM's purge_node() fails then raise an error.
1 parent b062fe6 commit f0fd45f

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

cm/chef.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,13 @@ def purge_node(node):
140140
:param node: a dict containing the id of a node to purge
141141
"""
142142
client = _get_client()
143-
client.delete_node(node['id'])
144-
client.delete_client(node['id'])
143+
node_id = node['id']
144+
body, status = client.delete_node(node_id)
145+
if status != 200:
146+
raise RuntimeError('Could not purge node {node_id}: {body}'.format(**locals()))
147+
body, status = client.delete_client(node_id)
148+
if status != 200:
149+
raise RuntimeError('Could not purge node client {node_id}: {body}'.format(**locals()))
145150

146151

147152
def converge_controller():

0 commit comments

Comments
 (0)