You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible/lib/ansible
Sam Thursfield 5d2652f31b Fix authorized_key module crashing when given an invalid key
I tried a playbook with the following (accidentally wrong) task:

  tasks:
      - name: authorized key test
        authorized_key: key=/home/sam/.ssh/id_rsa.pub key_options='command="/foo/bar"' user=sam

I got the following traceback:

    TASK: [authorized key test] ***************************************************
    failed: [localhost] => {"failed": true, "parsed": false}
    Traceback (most recent call last):
    File "/home/sam/.ansible/tmp/ansible-tmp-1427110003.65-277897441194582/authorized_key", line 2515, in <module>
        main()
    File "/home/sam/.ansible/tmp/ansible-tmp-1427110003.65-277897441194582/authorized_key", line 460, in main
        results = enforce_state(module, module.params)
    File "/home/sam/.ansible/tmp/ansible-tmp-1427110003.65-277897441194582/authorized_key", line 385, in enforce_state
        parsed_new_key = (parsed_new_key[0], parsed_new_key[1], parsed_options, parsed_new_key[3])
    TypeError: 'NoneType' object has no attribute '__getitem__'

With this fix, I see the expected error instead:

    TASK: [authorized key test] ***************************************************
    failed: [localhost] => {"failed": true}
    msg: invalid key specified: /home/sam/.ssh/id_rsa.pub
8 years ago
..
cli Transform vault_pass into text when we read it in from the user or a file. (#18699) 8 years ago
compat Move py34 mock_open compat to compat/test/mock (#17157) 8 years ago
config Making the switch to v2 10 years ago
errors Add error info if tabs are found in the yaml (#18343) 8 years ago
executor unified boolean function 8 years ago
galaxy For container enabled role, display warning only when not ANSIBLE_CONTAINER (#18717) 8 years ago
inventory Properly sort groups by name as well as depth when getting vars 8 years ago
module_utils module_utils: ovirt: Add support to fetch nested object's attributes (#18666) 8 years ago
modules Fix authorized_key module crashing when given an invalid key 8 years ago
parsing Remove method that isn't used here. (#18713) 8 years ago
playbook smart quotes, die die die. 8 years ago
plugins add back reverted change to network_cli (#18761) 8 years ago
template always template when called from template (#18490) 8 years ago
utils module_utils: ovirt: Add support to fetch nested object's attributes (#18666) 8 years ago
vars ansible_playbook_python (#18530) 8 years ago
__init__.py Fix ziploader for the cornercase of ansible invoking ansible. 9 years ago
constants.py Document the get_config function 8 years ago
release.py Bumping devel version to 2.3.0 8 years ago
test-requirements.txt Making the switch to v2 10 years ago