We are adding prescript for VM manager . I want to add the backup completion of VM as prescript and if not completed , it should not proceed for applying patches .
query -
1 -can we restrict it . like if backup not completed then stage:apply patches should not start on that specific VM.or automatically it removes the VM from patch apply?
2- I am trying to create a basic - prescript for linux (ubuntu) . to check the space, . even the permissions are fine but it is not storing results to storage object and getting failed . Any suggestion please
#!/bin/bash
echo $(cat /etc/os-release) > prepatch.txt
gsutil cp prepatch.txt gs://prescript/
1 Like
Hi,
Regarding not running the patch in case of a particular situation there are two possible routes that come to mind.
-
Exactly as you propose, you can use the prescript, if this script returns an error the patch process is halted, this see this useful blog post here.
-
Another approach might be to filter the patch job using labels and then have a mechanism where your backup process writes label or removes a label, although I think your original approach is probably best.
By the way, it is in preview at the time of writing, but you might want to keep an eye on ‘instant snapshots’, this is meant as a mechanism exactly for this usecase, see here.
Regarding the error in your script, do you see it run at all? does it log on the serial console? does the service account of the VM have permission/scopes to access the bucket?
Best,
Alex