Deployment Manager update error: Deployment in preview must not have a target with UPDATE

笑着哭i 提交于 2019-12-11 02:57:16

问题


Every time I try to run an update through deployment manager to an existing deployment in preview, I get the error:

$ gcloud deployment-manager deployments update abc --config abc.yaml
ERROR: (gcloud.deployment-manager.deployments.update) ResponseError: code=400, message=Invalid value for field 'resource.target': ''.  Deployment in preview must not have a target with UPDATE

However, if I don't use the update on the gcloud command line and go to the console and click 'deploy' the update goes through fine.

What can be causing this?


回答1:


Just ran into this, I wasn't following the instructions properly. After you created something in preview you do NOT pass the config again you just apply.

create preview

gcloud deployment-manager deployments update my-deployment --config my-config.yaml --preview

run deployment

gcloud deployment-manager deployments update my-deployment

Docs https://cloud.google.com/deployment-manager/docs/deployments/updating-deployments#make_the_update_request




回答2:


Cancel the preview and then run the deployment update again.

gcloud deployment-manager deployments cancel-preview DEPLOYMENT



回答3:


This is an issue on our end. We are currently working on a fix; I cannot provide an ETA for the fix at the moment. I strongly suggest continuing to use the work around you’ve found by deploying through the console.




回答4:


For me the issue was that I was calling the update API for applying the preview with the full body parameter that I passed when first creating the preview.

The fix was to pass only the fingerprint and name properties in the body parameter for the preview-apply call.

project_name = '...'
deployment_name = '...'

existing_deployment = service.deployments().get(
    project=project_name,
    deployment=deployment_name).execute()

service.deployments().update(
    project=project_name,
    deployment=deployment_name,
    body={
        'name': deployment_name,
        'fingerprint': existing_deployment["fingerprint"],
    },
    preview=False).execute()


来源:https://stackoverflow.com/questions/52203811/deployment-manager-update-error-deployment-in-preview-must-not-have-a-target-wi

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!