[英]bash trying to pass in a variable into curl command
我試圖在 curl 命令中使用變量,我要么得到以下兩個之一:
test.sh 第 32 行:在尋找匹配`"'
時出現意外的 EOF
test.sh 第 33 行:語法錯誤:文件意外結束
"$key"
我的命令是:
curl 'http://1.1.1.1:8080/v2-beta/projects/1a25/stack' -H 'content-type: application/json' -data-binary $'{"system":true,"type":"stack","name":"ecr","startOnCreate":true,"environment":{"key_id":"$key","access_key":"214356","aws_region":"ap-southeast-2","auto_create":"false","log_level":"INFO","registry_in_which_environment":"current","environment_api_endpoint":"12345.dkr.amazonaws.com","environment_api_access_key":"7AC2D3FE5A1C12345","environment_api_secret_key":"QMmwp7ebmzK1ZcUCjoRM12345"},"dockerCompose":"ecr-updater:\\n environment:\\n AWS_ACCESS_KEY_ID: ${aws_access_key_id}\\n AWS_SECRET_ACCESS_KEY: ${aws_secret_access_key}\\n AWS_REGION: ${aws_region}\\n AUTO_CREATE: ${auto_create}\\n LOG_LEVEL: ${log_level}\\n {{- if eq .Values.registry_in_which_environment \\"other\\" }}\\n CATTLE_URL: ${environment_api_endpoint}\\n CATTLE_ACCESS_KEY: ${environment_api_access_key}\\n CATTLE_SECRET_KEY: ${environment_api_secret_key}\\n {{- end }}\\n labels:\\n io.rancher.container.pull_image: always\\n {{- if eq .Values.registry_in_which_environment \\"current\\" }}\\n io.rancher.container.create_agent: \'true\'\\n io.rancher.container.agent.role: environment\\n {{- end }}\\n tty: true\\n image: rancher/rancher-ecr-credentials:v2.0.1\\n stdin_open: true\\n","rancherCompose":".catalog:\\n name: \\"ECR Credential Updater\\"\\n version: \\"v2.0.1\\"\\n description: \\"Updates credentials for ECR in Rancher\\"\\n minimum_rancher_version: \\"v1.6.13-rc1\\"\\n questions:\\n - variable: \\"aws_access_key_id\\"\\n label: \\"AWS Access Key ID\\"\\n description: \\"AWS API Access Key to use for obtaining ECR credentials. Not required if using IAM roles.\\"\\n required: false\\n type: \\"string\\"\\n - variable: \\"aws_secret_access_key\\"\\n label: \\"AWS Secret Access Key\\"\\n description: \\"AWS API Secret Key to use for obtaining ECR credentials. Not required if using IAM roles.\\"\\n required: false\\n type: \\"string\\"\\n - variable: \\"aws_region\\"\\n label: \\"AWS Region\\"\\n description: \\"AWS Region that hosts the ECR\\"\\n default: us-east-1\\n required: true\\n type: \\"string\\"\\n - variable: \\"auto_create\\"\\n label: \\"Auto Create\\"\\n description: \\"Automatically create registry in Rancher for corresponding ECR repo if it doesn\'t already exist\\"\\n default: \\"false\\"\\n required: true\\n type: \\"string\\"\\n - variable: \\"log_level\\"\\n label: \\"Log Level\\"\\n description: \\"Logging level to run service at\\"\\n default: \\"INFO\\"\\n required: true\\n type: \\"string\\"\\n - variable: \\"registry_in_which_environment\\"\\n type: enum\\n label: \\"Registry Environment\\"\\n description: \\"Which environment is the AWS registry located?\\"\\n default: current\\n options:\\n - current\\n - other\\n - variable: \\"environment_api_endpoint\\"\\n label: \\"URL (Environment API Endpoint) of Registry to be Updated\\"\\n description: \\"URL for where the registry is located. This is the endpoint, which can be found under the Advanced Options under API -> Keys, for an Environment API Key.\\"\\n default: \\"\\"\\n required: false\\n type: \\"string\\"\\n - variable: \\"environment_api_access_key\\"\\n label: \\"Access Key of an Environment API Key\\"\\n description: \\"This access key must be for the environment where the registry will need to be updated. This access key will be created in the same environment listed for the URL. This can be created in the Advanced Options under API.\\"\\n default: \\"\\"\\n required: false\\n type: \\"string\\"\\n - variable: \\"environment_api_secret_key\\"\\n label: \\"Secret Key of an Environment API Key\\"\\n description: \\"This secret key must be for the environment where the registry will need to be updated. This secret key will be created in the same environment listed for the URL. This can be created in the Advanced Options under API.\\"\\n default: \\"\\"\\n required: false\\n type: \\"string\\"\\necr-updater:\\n scale: 1\\n","externalId":"catalog://library:infra*ecr:1"}'
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.