Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
aronatkins opened this issue Nov 6, 2023 · 0 comments · Fixed by #1025
Assignees

Comments

@aronatkins
Copy link
Contributor

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.

@aronatkins aronatkins self-assigned this Nov 6, 2023
@aronatkins aronatkins linked a pull request Nov 6, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant