From 5ec33a31ea4ae6578f918e6de6b6af413127bde4 Mon Sep 17 00:00:00 2001 From: Hong Ooi Date: Fri, 24 Jul 2020 14:58:37 +1000 Subject: [PATCH] some resources don't have provisioning state --- R/az_resource.R | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/R/az_resource.R b/R/az_resource.R index 422b94d..1c269e8 100644 --- a/R/az_resource.R +++ b/R/az_resource.R @@ -357,17 +357,22 @@ private=list( for(i in 1:1000) # some resources can take a long time to provision (AKS, Kusto) { message(".", appendLF=FALSE) - Sys.sleep(5) # some resources return from creation before they can be retrieved, let http 404's through res <- private$res_op(http_status_handler="pass") http_stat <- httr::status_code(res) state <- httr::content(res)$properties$provisioningState + # some resources don't have provisioning state (eg Microsoft.Compute/sshPublicKey) + if(is.null(state)) + state <- "Succeeded" + success <- http_stat < 300 && state == "Succeeded" failure <- http_stat >= 300 || state %in% c("Error", "Failed") if(success || failure) break + + Sys.sleep(5) } if(success) message("\nDeployment successful")