rstudio / rsconnect

Publish Shiny Applications, RMarkdown Documents, Jupyter Notebooks, Plumber APIs, and more

Home Page:http://rstudio.github.io/rsconnect/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Connect accounts registered with rsconnect 0.8.29 cannot deploy to new locations with current rsconnect

aronatkins opened this issue · comments

User registration previously recorded username in the account DCF file.

rsconnect/R/accounts.R

Lines 409 to 439 in 9ce427e

registerUserApiKey <- function(serverName, accountName, userId, apiKey) {
# write the user info
configFile <- accountConfigFile(accountName, serverName)
dir.create(dirname(configFile), recursive = TRUE, showWarnings = FALSE)
write.dcf(list(username = accountName,
accountId = userId,
apiKey = apiKey,
server = serverName),
configFile)
# set restrictive permissions on it if possible
if (identical(.Platform$OS.type, "unix"))
Sys.chmod(configFile, mode = "0600")
}
registerUserToken <- function(serverName, accountName, userId, token,
privateKey) {
# write the user info
configFile <- accountConfigFile(accountName, serverName)
dir.create(dirname(configFile), recursive = TRUE, showWarnings = FALSE)
write.dcf(list(username = accountName,
accountId = userId,
token = token,
server = serverName,
private_key = as.character(privateKey)),
configFile)
# set restrictive permissions on it if possible
if (identical(.Platform$OS.type, "unix"))
Sys.chmod(configFile, mode = "0600")
}

We now record name.

rsconnect/R/accounts.R

Lines 325 to 358 in 98ccc9a

registerAccount <- function(serverName,
accountName,
accountId,
token = NULL,
secret = NULL,
private_key = NULL,
apiKey = NULL) {
check_string(serverName)
check_string(accountName)
if (!is.null(secret)) {
secret <- as.character(secret)
}
fields <- list(
name = accountName,
server = serverName,
accountId = accountId,
token = token,
secret = secret,
private_key = private_key,
apiKey = apiKey
)
path <- accountConfigFile(accountName, serverName)
dir.create(dirname(path), recursive = TRUE, showWarnings = FALSE)
write.dcf(compact(fields), path, width = 100)
# set restrictive permissions on it if possible
if (identical(.Platform$OS.type, "unix"))
Sys.chmod(path, mode = "0600")
path
}

The accountInfo function does not rewrite username to name, which can cause problems for downstream code that expects account records to contain a stable set of fields.