Skip to content

leap_cli: dont create node files when add node fails

When I add a node and it fails because I screwed something up, I'd prefer that it didn't create the broken node file because I need to then remove the node in order to re-do the node add command.

For example, first I create the node pcmx1 with the incorrectly specified service 'mx1':

$ leap node add pcmx1 services:mx1 ip_address:202.85.227.217
 = created nodes/pcmx1.json
 = error in node "pcmx1": the service "mx1" does not exist.

I realize my mistake and so I try to correct it:

$ leap node add pcmx1 services:mx ip_address:202.85.227.217 
 = error in node "pcmx1": the service "mx1" does not exist.
 = error Sorry, we can't continue because this file already exists: nodes/pcmx1.json.
 = bailing out 

hm, I can't easily correct it by just up arrow and changing the services line, instead I need to 'leap node rm pcmx1' and then re-do the add.

(from redmine: created on 2013-09-04, closed on 2014-04-05)