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

Error parsing parameter '--targets': Expected: '=', received: ''' for input: '{"Key":"tag:Name","Values":["LDAPHost_env-sandbox"]}' #3070

Closed
hapx101 opened this issue Jan 4, 2018 · 3 comments
Labels
closing-soon This issue will automatically close in 4 days unless further comments are made.

Comments

@hapx101
Copy link

hapx101 commented Jan 4, 2018

I am using AWS EC2 SSM for doing an automated deployment from Jenkins build pipeline. A SSM document to run a shell script is provided in the SSM document. The jenkins pipeline form the following command:

aws ssm send-command --document-name "Testdeployment" --targets '{"Key":"tag:Name","Values":["LDAPHost_env-sandbox"]}' --max-concurrency "1" --max-errors "1" --parameters '{"bucketName":["s3://testBucket"],"workingDirectory":["/tmp/"],"releaseName":["sandbox-v1"]}' --timeout-seconds 3600 --output-s3-bucket-name "testBucket" --output-s3-key-prefix "sandbox-v1/test/ssm/log" --region eu-west-1

Error message:

Error parsing parameter '--targets': Expected: '=', received: ''' for input:
'{"Key":"tag:Name","Values":["LDAPHost_env-sandbox"]}'

Configuration:
OS: Ubuntu 16.04.2 LTS
AWS CLI: 1.11.122
Python: 2.7.12
Linux: 4.4.0-1044-aws
botocore:1.5.85

@jamesls
Copy link
Member

jamesls commented Jan 4, 2018

This looks like a quoting issue with jenkins. When I run your command directly in the terminal I don't get that error:

$ aws ssm send-command --document-name "Testdeployment" --targets '{"Key":"tag:Name","Values":["LDAPHost_env-sandbox"]}' --max-concurrency "1" --max-errors "1" --parameters '{"bucketName":["s3://testBucket"],"workingDirectory":["/tmp/"],"releaseName":["sandbox-v1"]}' --timeout-seconds 3600 --output-s3-bucket-name "testBucket" --output-s3-key-prefix "sandbox-v1/test/ssm/log" --region eu-west-1

An error occurred (InvalidDocument) when calling the SendCommand operation:

To debug this issue, run the command with --debug and you'll see the exact string that the CLI is receiving:

2018-01-04 13:27:37,186 - MainThread - awscli.clidriver - DEBUG - CLI version: aws-cli/1.14.18 Python/2.7.14 Darwin/16.7.0 botocore/1.8.22
2018-01-04 13:27:37,186 - MainThread - awscli.clidriver - DEBUG - Arguments entered to CLI: ['ssm', 'send-command', '--document-name', 'Testdeployment', '--targets', '{"Key":"tag:Name","Values":["LDAPHost_env-sandbox"]}', '--max-concurrency', '1', '--max-errors', '1', '--parameters', '{"bucketName":["s3://testBucket"],"workingDirectory":["/tmp/"],"releaseName":["sandbox-v1"]}', '--timeout-seconds', '3600', '--output-s3-bucket-name', 'testBucket', '--output-s3-key-prefix', 'sandbox-v1/test/ssm/log', '--region', 'eu-west-1', '--debug']

I suspect what you'll see is that the single quote is being passed along to the CLI, whereas normally when you run the command interactively you're shell will strip out the single quotes before passing it to python.

If you're still seeing the issue, please post your debug logs with the "Arguments entered to CLI" line and I'll take another look.

@jamesls jamesls added the closing-soon This issue will automatically close in 4 days unless further comments are made. label Jan 4, 2018
@hapx101
Copy link
Author

hapx101 commented Jan 5, 2018

Thanks. That solved the issue.

@hapx101 hapx101 closed this as completed Jan 5, 2018
@Iorek73
Copy link

Iorek73 commented Nov 19, 2019

Same issue, this is outddated -

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closing-soon This issue will automatically close in 4 days unless further comments are made.
Projects
None yet
Development

No branches or pull requests

3 participants