Skip to content

Commit 21d0634

Browse files
committed
Ignore Chef 404s when destroying a node.
1 parent 6ca8b34 commit 21d0634

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

cm/chef.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,11 @@ def purge_node(node):
142142
client = _get_client()
143143
node_id = node['id']
144144
body, status = client.delete_node(node_id)
145-
if status != 200:
146-
raise RuntimeError('Could not purge node {node_id}: {body}'.format(**locals()))
145+
if status not in [200, 404]:
146+
raise RuntimeError("Could not purge node {node_id}: {body}".format(**locals()))
147147
body, status = client.delete_client(node_id)
148-
if status != 200:
149-
raise RuntimeError('Could not purge node client {node_id}: {body}'.format(**locals()))
148+
if status not in [200, 404]:
149+
raise RuntimeError("Could not purge node client {node_id}: {body}".format(**locals()))
150150

151151

152152
def converge_controller():
@@ -312,6 +312,6 @@ def _purge(databag_name, item_name):
312312
"""
313313
client = _get_client()
314314
body, status = client.delete_databag_item(databag_name, item_name)
315-
if status == 200 or status == 404:
315+
if status in [200, 404]:
316316
return body, status
317317
raise RuntimeError('Could not purge {item_name}: {body}'.format(**locals()))

0 commit comments

Comments
 (0)