Backport of docs: Simplify example jq commands by removing pipes into release/1.16.x (#18334)

backport of commit 5d148141da

Co-authored-by: Blake Covarrubias <blake@covarrubi.as>
pull/18341/head
hc-github-team-consul-core 2023-07-31 17:12:38 -04:00 committed by GitHub
parent 7500200376
commit 73d372bdbd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 8 additions and 8 deletions

View File

@ -100,13 +100,13 @@ In order to use the Update CA Configuration HTTP endpoint, the private key and c
must be passed via JSON: must be passed via JSON:
```shell-session ```shell-session
$ jq --null-input --arg key "$(cat root.key)" --arg cert "$(cat root.crt)" ' $ jq --null-input --rawfile key root.key --rawfile cert root.crt '
{ {
"Provider": "consul", "Provider": "consul",
"Config": { "Config": {
"LeafCertTTL": "72h", "LeafCertTTL": "72h",
"PrivateKey": $key, "PrivateKey": $key | sub("\\n$"; ""),
"RootCert": $cert, "RootCert": $cert | sub("\\n$"; ""),
"IntermediateCertTTL": "8760h" "IntermediateCertTTL": "8760h"
} }
}' > ca_config.json }' > ca_config.json

View File

@ -346,9 +346,9 @@ script to the container.
# Obtain details from the task metadata # Obtain details from the task metadata
ECS_TASK_META=$(curl -s $ECS_CONTAINER_METADATA_URI_V4/task) ECS_TASK_META=$(curl -s $ECS_CONTAINER_METADATA_URI_V4/task)
TASK_REGION=$(echo "$ECS_TASK_META" | jq -r .TaskARN | cut -d ':' -f 4) TASK_REGION=$(echo "$ECS_TASK_META" | jq --raw-output '.TaskARN / ":" | .[3]')
TASK_ID=$(echo "$ECS_TASK_META" | jq -r .TaskARN | cut -d '/' -f 3) TASK_ID=$(echo "$ECS_TASK_META" | jq --raw-output '.TaskARN / "/" | .[2]')
CLUSTER_ARN=$(echo "$ECS_TASK_META" | jq -r .TaskARN | sed -E 's|:task/([^/]+).*|:cluster/\1|') CLUSTER_ARN=$(echo "$ECS_TASK_META" | jq --raw-output '.TaskARN | sub(":task/(?<cluster>[^/]+).*"; ":cluster/\(.cluster)")')
# Write the CA certs to a files in the shared volume # Write the CA certs to a files in the shared volume
echo "$CONSUL_CACERT_PEM" > /consul/consul-ca-cert.pem echo "$CONSUL_CACERT_PEM" > /consul/consul-ca-cert.pem

View File

@ -202,7 +202,7 @@ be tricky to debug why things aren't working. Some tips for setting up OIDC:
request to obtain a JWT that you can inspect. An example of how to decode the request to obtain a JWT that you can inspect. An example of how to decode the
JWT (in this case located in the `access_token` field of a JSON response): JWT (in this case located in the `access_token` field of a JSON response):
cat jwt.json | jq --raw-output .access_token | cut -d. -f2 | base64 --decode jq --raw-output '.access_token / "." | .[1] | @base64d' jwt.json
- The [`VerboseOIDCLogging`](#verboseoidclogging) option is available which - The [`VerboseOIDCLogging`](#verboseoidclogging) option is available which
will log the received OIDC token if debug level logging is enabled. This can will log the received OIDC token if debug level logging is enabled. This can

View File

@ -44,7 +44,7 @@ There is a syntax error in your configuration file. If the error message doesn't
```shell-session ```shell-session
$ consul agent -server -config-file server.json $ consul agent -server -config-file server.json
==> Error parsing server.json: invalid character '`' looking for beginning of value ==> Error parsing server.json: invalid character '`' looking for beginning of value
$ cat server.json | jq . $ jq . server.json
parse error: Invalid numeric literal at line 3, column 29 parse error: Invalid numeric literal at line 3, column 29
``` ```