openvcloud / 0-templates

Apache License 2.0
1 stars 5 forks source link

node template: install logic #43

Closed zaibon closed 6 years ago

zaibon commented 6 years ago

I don't like how the install logic is: https://github.com/openvcloud/0-templates/blob/1e98b285c32474a5621e145b6a8563e10c1d5440/templates/node/node.py#L119-L128

Now is means if the state actions:install is not ok, but the machine exists, we stop. But this is wrong cause if we don't have the state install:ok that means that the installation didn't went all the way so having a machine that is already created means this machine is in a bad state and should probably be recreated from scratch

katia-e commented 6 years ago

@zaibon, now we raise an error if machine already exists, what should be done instead? Delete the machine?

zaibon commented 6 years ago

well since you know the VM is in a undefined state, this is probably the most sane thing to do.

katia-e commented 6 years ago

@zaibon , what if the machine was created and being used by another robot? If action:install is not ok it might be that this machine was installed before by another user. Is this situation possible? Then we might be deleting machine used by someone/something else.

katia-e commented 6 years ago

Is it an option to add a flag to schema, something like createNew=False, so only if we explicitly set it to createNew=False, old machine gets removed. And otherwise will just throw an error.