From 389494082415a1cf49d87801dc51bad30ab0fd9d Mon Sep 17 00:00:00 2001 From: Blake Covarrubias Date: Mon, 31 Jul 2023 14:01:39 -0700 Subject: [PATCH] docs: Simplify example jq commands by removing pipes (#18327) Simplify jq command examples by removing pipes to other commands. --- website/content/docs/connect/ca/consul.mdx | 6 +++--- website/content/docs/ecs/manual/secure-configuration.mdx | 6 +++--- website/content/docs/security/acl/auth-methods/oidc.mdx | 2 +- website/content/docs/troubleshoot/common-errors.mdx | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/website/content/docs/connect/ca/consul.mdx b/website/content/docs/connect/ca/consul.mdx index 8d36c00121..870bea4fe4 100644 --- a/website/content/docs/connect/ca/consul.mdx +++ b/website/content/docs/connect/ca/consul.mdx @@ -100,13 +100,13 @@ In order to use the Update CA Configuration HTTP endpoint, the private key and c must be passed via JSON: ```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", "Config": { "LeafCertTTL": "72h", - "PrivateKey": $key, - "RootCert": $cert, + "PrivateKey": $key | sub("\\n$"; ""), + "RootCert": $cert | sub("\\n$"; ""), "IntermediateCertTTL": "8760h" } }' > ca_config.json diff --git a/website/content/docs/ecs/manual/secure-configuration.mdx b/website/content/docs/ecs/manual/secure-configuration.mdx index 3a2c7fdf29..ec374670bc 100644 --- a/website/content/docs/ecs/manual/secure-configuration.mdx +++ b/website/content/docs/ecs/manual/secure-configuration.mdx @@ -346,9 +346,9 @@ script to the container. # Obtain details from the task metadata 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_ID=$(echo "$ECS_TASK_META" | jq -r .TaskARN | cut -d '/' -f 3) -CLUSTER_ARN=$(echo "$ECS_TASK_META" | jq -r .TaskARN | sed -E 's|:task/([^/]+).*|:cluster/\1|') +TASK_REGION=$(echo "$ECS_TASK_META" | jq --raw-output '.TaskARN / ":" | .[3]') +TASK_ID=$(echo "$ECS_TASK_META" | jq --raw-output '.TaskARN / "/" | .[2]') +CLUSTER_ARN=$(echo "$ECS_TASK_META" | jq --raw-output '.TaskARN | sub(":task/(?[^/]+).*"; ":cluster/\(.cluster)")') # Write the CA certs to a files in the shared volume echo "$CONSUL_CACERT_PEM" > /consul/consul-ca-cert.pem diff --git a/website/content/docs/security/acl/auth-methods/oidc.mdx b/website/content/docs/security/acl/auth-methods/oidc.mdx index 7d22f01df7..0c0f9efda0 100644 --- a/website/content/docs/security/acl/auth-methods/oidc.mdx +++ b/website/content/docs/security/acl/auth-methods/oidc.mdx @@ -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 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 will log the received OIDC token if debug level logging is enabled. This can diff --git a/website/content/docs/troubleshoot/common-errors.mdx b/website/content/docs/troubleshoot/common-errors.mdx index 505d360b05..b2d41b6314 100644 --- a/website/content/docs/troubleshoot/common-errors.mdx +++ b/website/content/docs/troubleshoot/common-errors.mdx @@ -44,7 +44,7 @@ There is a syntax error in your configuration file. If the error message doesn't ```shell-session $ consul agent -server -config-file server.json ==> 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 ```