Commit Graph

11 Commits (273abeb8ee77cbfae8ebc888388a1514d2bac0d7)

Author SHA1 Message Date
Sam Thursfield 60397fae0f 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
10 years ago
Dag Wieers 0a91ace6ad Update authorized_key.py
Fix a (common) error in the examples. This is something that may go unnoticed during troubleshooting when copy&pasting the example.
10 years ago
Edward Larkey 4db27877bf Fix typo in authorized key module documentation.
Added opening double quote
10 years ago
Brian Coca 55b06568b0 added note that url src is only avaialable from 1.9 on 10 years ago
Toshio Kuratomi b84f566ee7 Tabs to spaces 10 years ago
Jesse Keating e0c5b4340d Add exclusive option to authorized_keys
This option allows the module to ensure that ONLY the specified keys
exist in the authorized_keys file. All others will be removed. This is
quite useful when rotating keys and ensuring no other key will be
accepted.
10 years ago
Jeff Gonzalez 27c046ae79 Refactored code to use module utility fetch_url function. 10 years ago
Jeff Gonzalez e9ae165792 Added documentation for using url as key source 10 years ago
Jeff Gonzalez 54214f83b5 Added ability to use url as key source 10 years ago
Fabrice Bernhard 1ef8c26c0e Typo in comments
Credit goes to @kbsali 
@pborreli : you did not see that one? :-)
10 years ago
Michael DeHaan c8e1a2077e file extensions! 10 years ago