quarto: engines metadata is vector, not singular
aronatkins opened this issue · comments
Quarto content can report multiple engines, which arrives as the metadata
argument to deployApp()
and others.
That metadata is eventually serialized into a deployment record. The presence of multiple engines causes rsconnect to write two records into a single DCF file.
record <- rsconnect:::deploymentRecord(
name = "the-name",
title = "the-title",
username = "the-username",
account = "the-account",
server = "the-server",
metadata = list(quarto_engines = c("knitr","markdown"))
)
t <- tempfile()
rsconnect:::writeDeploymentRecord(record, t)
read.dcf(t)
#> name title username account server hostUrl
#> [1,] "the-name" "the-title" "the-username" "the-account" "the-server" ""
#> [2,] "the-name" "the-title" "the-username" "the-account" "the-server" ""
#> appId bundleId url version quarto_engines
#> [1,] "" "" "" "1" "knitr"
#> [2,] "" "" "" "1" "markdown"
We serialize envVars
to a comma-separated list, but take no similar action for other multi-value fields.
Lines 73 to 76 in 525289d
Line 141 in 525289d
Discovered while investigating #1014
The RStudio IDE sends a vector of engines:
The quarto R package also provides a vector:
Additionally, rsconnect can compute a vector of engines:
rsconnect/R/appMetadata-quarto.R
Lines 18 to 22 in 525289d
The vector of engines is used when determining if R or Python are needed:
Lines 142 to 143 in 525289d
Line 132 in 525289d
That data is also sent in the manifest.json to guide environment reconstruction.
Lines 229 to 230 in 525289d
We should convert metadata
fields from vectors to a comma-separated string when writing the DCF file, but can probably leave them in that form when the DCF file is read.
A consequence of this problem: The RStudio IDE could show two target deployments when one existed, and publishing attempts fail with errors like:
── Preparing for deployment ────────────────────────────────────────────────────
Error in `rsconnect::deployApp()`:
! This directory has been previously deployed in multiple places.
Please use `appName`, `server` or `account` to disambiguate.
Known applications:
• quarto-failed-republish (server: SERVERNAME / username: USERNAME):
<https://SERVERNAME/content/cf5960ea-484f-4285-9207-2b17aca4a27e/>
• quarto-failed-republish (server: SERVERNAME / username: USERNAME):
<https://SERVERNAME/content/cf5960ea-484f-4285-9207-2b17aca4a27e/>
Backtrace:
▆
1. └─rsconnect::deployApp(...)
2. └─rsconnect:::deploymentTarget(...)
3. └─rsconnect:::disambiguateDeployments(appDeployments, error_call = error_call)
4. └─rsconnect:::cli_menu(...)
5. └─cli::cli_abort(c(header, not_interactive), .envir = .envir, call = error_call)
6. └─rlang::abort(...)
Execution halted