From 839b24fe4457cc23fe4d6127d98d6744e89be716 Mon Sep 17 00:00:00 2001 From: Hong Ooi Date: Mon, 15 Jul 2019 22:05:01 +1000 Subject: [PATCH] move admin user check to better location --- R/add_acr_methods.R | 2 +- R/az_container_registry.R | 6 +++--- man/create_acr.Rd | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/R/add_acr_methods.R b/R/add_acr_methods.R index 11e6741..b6ea5b1 100644 --- a/R/add_acr_methods.R +++ b/R/add_acr_methods.R @@ -14,7 +14,7 @@ #' - `name`: The name of the container registry. #' - `location`: The location/region in which to create the container registry. Defaults to this resource group's location. #' - `admin_user_enabled`: Whether to enable the Admin user. Currently this must be TRUE to allow Docker to access the registry. -#' - `sku`: The SKU. +#' - `sku`: Either "Basic", "Standard" (the default) or "Premium". #' - `wait`: Whether to wait until the ACR resource provisioning is complete. #' - `...`: Other named arguments to pass to the [az_resource] initialization function. #' diff --git a/R/az_container_registry.R b/R/az_container_registry.R index 615d1c2..351bb67 100644 --- a/R/az_container_registry.R +++ b/R/az_container_registry.R @@ -77,6 +77,9 @@ public=list( list_credentials=function() { + if(!self$properties$adminUserEnabled) + stop("Admin user account is disabled", call.=FALSE) + creds <- private$res_op("listCredentials", http_verb="POST") pwds <- sapply(creds$passwords, `[[`, "value") names(pwds) <- sapply(creds$passwords, `[[`, "name") @@ -99,9 +102,6 @@ public=list( server <- paste0("https://", self$properties$loginServer) if(as_admin) { - if(!self$properties$adminUserEnabled) - stop("Admin user account is disabled", call.=FALSE) - creds <- self$list_credentials() docker_registry(server, username=creds$username, password=creds$passwords[1], app=NULL) } diff --git a/man/create_acr.Rd b/man/create_acr.Rd index 7050e4b..e169319 100644 --- a/man/create_acr.Rd +++ b/man/create_acr.Rd @@ -18,7 +18,7 @@ Method for the \link[AzureRMR:az_resource_group]{AzureRMR::az_resource_group} cl \item \code{name}: The name of the container registry. \item \code{location}: The location/region in which to create the container registry. Defaults to this resource group's location. \item \code{admin_user_enabled}: Whether to enable the Admin user. Currently this must be TRUE to allow Docker to access the registry. -\item \code{sku}: The SKU. +\item \code{sku}: Either "Basic", "Standard" (the default) or "Premium". \item \code{wait}: Whether to wait until the ACR resource provisioning is complete. \item \code{...}: Other named arguments to pass to the \link{az_resource} initialization function. }