some resources don't have provisioning state

This commit is contained in:
Hong Ooi 2020-07-24 14:58:37 +10:00
Родитель 0841472b2a
Коммит 5ec33a31ea
1 изменённых файлов: 6 добавлений и 1 удалений

Просмотреть файл

@ -357,17 +357,22 @@ private=list(
for(i in 1:1000) # some resources can take a long time to provision (AKS, Kusto) for(i in 1:1000) # some resources can take a long time to provision (AKS, Kusto)
{ {
message(".", appendLF=FALSE) message(".", appendLF=FALSE)
Sys.sleep(5)
# some resources return from creation before they can be retrieved, let http 404's through # some resources return from creation before they can be retrieved, let http 404's through
res <- private$res_op(http_status_handler="pass") res <- private$res_op(http_status_handler="pass")
http_stat <- httr::status_code(res) http_stat <- httr::status_code(res)
state <- httr::content(res)$properties$provisioningState 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" success <- http_stat < 300 && state == "Succeeded"
failure <- http_stat >= 300 || state %in% c("Error", "Failed") failure <- http_stat >= 300 || state %in% c("Error", "Failed")
if(success || failure) if(success || failure)
break break
Sys.sleep(5)
} }
if(success) if(success)
message("\nDeployment successful") message("\nDeployment successful")