{"action":"opened","issue":{"url":"https://api.github.com/repos/aws/aws-cli/issues/3829","repository_url":"https://api.github.com/repos/aws/aws-cli","labels_url":"https://api.github.com/repos/aws/aws-cli/issues/3829/labels{/name}","comments_url":"https://api.github.com/repos/aws/aws-cli/issues/3829/comments","events_url":"https://api.github.com/repos/aws/aws-cli/issues/3829/events","html_url":"https://github.com/aws/aws-cli/issues/3829","id":396190627,"node_id":"MDU6SXNzdWUzOTYxOTA2Mjc=","number":3829,"title":"[git-bash] aws iam create-role --path /x/ error: The specified value for path is invalid. It must begin and end with / and contain only alphanumeric characters and/or / characters.","user":{"login":"rlyders","id":4387200,"node_id":"MDQ6VXNlcjQzODcyMDA=","avatar_url":"https://avatars2.githubusercontent.com/u/4387200?v=4","gravatar_id":"","url":"https://api.github.com/users/rlyders","html_url":"https://github.com/rlyders","followers_url":"https://api.github.com/users/rlyders/followers","following_url":"https://api.github.com/users/rlyders/following{/other_user}","gists_url":"https://api.github.com/users/rlyders/gists{/gist_id}","starred_url":"https://api.github.com/users/rlyders/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rlyders/subscriptions","organizations_url":"https://api.github.com/users/rlyders/orgs","repos_url":"https://api.github.com/users/rlyders/repos","events_url":"https://api.github.com/users/rlyders/events{/privacy}","received_events_url":"https://api.github.com/users/rlyders/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2019-01-05T18:54:21Z","updated_at":"2019-01-05T18:54:21Z","closed_at":null,"author_association":"NONE","body":"***Running awscli in git-bash***\r\n\r\n**Windows 10**\r\n$ aws --version\r\n**aws-cli/1.16.84 Python/3.7.2 Windows/10 botocore/1.12.74**\r\n\r\n$ git --version\r\n**git version 2.12.0.windows.1**\r\n\r\nI get an error when I RUN the following in git-bash on Windows:\r\naws iam create-role --role-name testRole --path \"**/service-role/**\" --assume-role-policy-document file://trust-relationship.json --profile=$profile\r\n\r\nERROR: \r\n`\r\nAn error occurred (ValidationError) when calling the CreateRole operation: The specified value for path is invalid. It must begin and end with / and contain only alphanumeric characters and/or / characters.`\r\n\r\n\r\nThis same error occurs whether I surround the Path parameter in quotes, single quotes, or leave it unquoted.\r\n\r\nDebugging this error in Python (**awscli/clidriver.py: main()**) I find that the '--path' parameters equals '**C:/Program Files/Git/service-role/**' as opposed to '**/service-role/**'. Apparently the path is erroneously being interpreted as a file system path and being prefixed with the file path to git.\r\n\r\nMy ugly fix to this problem is the following hack starting on existing line 490:\r\n```\r\n        call_parameters = self._build_call_parameters(\r\n            parsed_args, self.arg_table)\r\n        LOG.debug( '**NEW** __call__: BEFORE call_parameters=%s' % call_parameters )\r\n        import re\r\n        call_parameters['Path']=re.sub( r'[a-zA-Z]:.*\\/Git', '', call_parameters['Path'])\r\n        LOG.debug( '**NEW** __call__: AFTER call_parameters=%s' % call_parameters )\r\n\r\n        event = 'calling-command.%s.%s' % (self._parent_name,\r\n                                           self._name)\r\n\r\n```\r\n\r\nI gather this could be an error with git-bash... I've only had time to debug this up to this point. I appreciate any advice you have on this. Thanks.\r\n\r\nResulting debug output showing corrected Path value\r\n\r\n```\r\n2019-01-05 12:37:58,003 - MainThread - awscli.clidriver - DEBUG - **NEW** __call__: BEFORE call_parameters={'Path': 'C:/Program Files/Git/service-role/', 'RoleName': 'smsRequestLambdaRole', 'AssumeRolePolicyDocument': '{\\n    \"Version\": \"2012-10-17\",\\n    \"Statement\": [\\n      {\\n        \"Effect\": \"Allow\",\\n        \"Principal\": {\\n          \"Service\": \"lambda.amazonaws.com\"\\n        },\\n        \"Action\": \"sts:AssumeRole\"\\n      }\\n    ]\\n}\\n'}\r\n2019-01-05 12:37:58,004 - MainThread - awscli.clidriver - DEBUG - **NEW** __call__: AFTER call_parameters={'Path': '/service-role/', 'RoleName': 'smsRequestLambdaRole', 'AssumeRolePolicyDocument': '{\\n    \"Version\": \"2012-10-17\",\\n    \"Statement\": [\\n      {\\n        \"Effect\": \"Allow\",\\n        \"Principal\": {\\n          \"Service\": \"lambda.amazonaws.com\"\\n        },\\n        \"Action\": \"sts:AssumeRole\"\\n      }\\n    ]\\n}\\n'}\r\n\r\n```\r\n\r\ntrust-relationship.json:\r\n\r\n```\r\n{\r\n    \"Version\": \"2012-10-17\",\r\n    \"Statement\": [\r\n      {\r\n        \"Effect\": \"Allow\",\r\n        \"Principal\": {\r\n          \"Service\": \"lambda.amazonaws.com\"\r\n        },\r\n        \"Action\": \"sts:AssumeRole\"\r\n      }\r\n    ]\r\n  }\r\n\r\n``` \r\n\r\nOriginal error log...\r\n\r\n```\r\n2019-01-05 12:07:37,292 - MainThread - botocore.hooks - DEBUG - Event after-call.iam.CreateRole: calling handler <function json_decode_policies at 0x0000021ECA743AE8>\r\n2019-01-05 12:07:37,293 - MainThread - awscli.clidriver - DEBUG - Exception caught in main()\r\nTraceback (most recent call last):\r\n  File \"C:\\users\\richa\\appdata\\local\\programs\\python\\python37\\lib\\site-packages\\awscli\\clidriver.py\", line 209, in main\r\n    return command_table[parsed_args.command](remaining, parsed_args)\r\n  File \"C:\\users\\richa\\appdata\\local\\programs\\python\\python37\\lib\\site-packages\\awscli\\clidriver.py\", line 350, in __call__\r\n    return command_table[parsed_args.operation](remaining, parsed_globals)\r\n  File \"C:\\users\\richa\\appdata\\local\\programs\\python\\python37\\lib\\site-packages\\awscli\\clidriver.py\", line 527, in __call__\r\n    call_parameters, parsed_globals)\r\n  File \"C:\\users\\richa\\appdata\\local\\programs\\python\\python37\\lib\\site-packages\\awscli\\clidriver.py\", line 649, in invoke\r\n    client, operation_name, parameters, parsed_globals)\r\n  File \"C:\\users\\richa\\appdata\\local\\programs\\python\\python37\\lib\\site-packages\\awscli\\clidriver.py\", line 669, in _make_client_call\r\n    **parameters)\r\n  File \"C:\\users\\richa\\appdata\\local\\programs\\python\\python37\\lib\\site-packages\\botocore\\client.py\", line 363, in _api_call\r\n    return self._make_api_call(operation_name, kwargs)\r\n  File \"C:\\users\\richa\\appdata\\local\\programs\\python\\python37\\lib\\site-packages\\botocore\\client.py\", line 667, in _make_api_call\r\n    raise error_class(parsed_response, operation_name)\r\nbotocore.exceptions.ClientError: An error occurred (ValidationError) when calling the CreateRole operation: The specified value for path is invalid. It must begin and end with / and contain only alphanumeric characters and/or / characters.\r\n2019-01-05 12:07:37,295 - MainThread - awscli.clidriver - DEBUG - Exiting with rc 255\r\n\r\nAn error occurred (ValidationError) when calling the CreateRole operation: The specified value for path is invalid. It must begin and end with / and contain only alphanumeric characters and/or / characters.`\r\n\r\n```\r\n"}}
{"actor":{"display_login":"rlyders"}}