Greetings all,
There looks to be a problem with specifying any key name containing a special
character (except dash and/or underscore) within 'nova keypair-add'. I am
currently running Folsom on Ubuntu and noticed the archives at
https://lists.launchpad.net/openstack/msg17626.html indicate the problem was
present on Essex as well and never resolved. I'm new to the project and only
beginning but it looks like the following function in nova/compute/api.py may
not be behaving properly to return an appropriate message (also if possible,
could a list of safe characters in the return message be possible?), and
instead reports Keypair data is invalid when clearly this is an issue with the
desired naming of the key pair (the same public key is accepted fine when 'safe
chars' (_-) only are used.
Any direction would be greatly appreciated. If I should be posting this bug
elsewhere, please let me know and I will happily do-so.
Thanks in advance,
def _validate_keypair_name(self, context, user_id, key_name):
safechars = "_-" + string.digts + string.ascii_letters
clean_value = "".join(x for x in key_name if x in safe chars)
if clean_value != key_name:
msg = _("Keypair name contains unsafe characters")
raise exception.InvalidKeypair(explanation=msg)
[…]
>>> The errors when trying to add anything defined outside of safechars:
# nova keypair-add --pub_key isinclair.id_rsa.pub isinclair_id_rsa
# nova keypair-add --pub_key isinclair.id_rsa.pub isinclair-id_rsa
#
# nova keypair-add --pub_key isinclair.id_rsa.pub isinclair.id_rsa
ERROR: Keypair data is invalid (HTTP 400) (Request-ID:
req-4a30f245-af5a-4b2e-854d-a842380889cc)
# nova keypair-add --pub_key isinclair.id_rsa.pub isinclair@id_rsa
ERROR: Keypair data is invalid (HTTP 400) (Request-ID:
req-dfec1608-e188-42e3-b922-3c1d49f4349a)
# nova keypair-add --pub_key isinclair.id_rsa.pub isinclair%id_rsa
ERROR: Keypair data is invalid (HTTP 400) (Request-ID:
req-ac791522-4e05-4cb8-a6eb-487c65b9a3c5)
# nova keypair-add --pub_key isinclair.id_rsa.pub 'isinclair.id_rsa'
ERROR: Keypair data is invalid (HTTP 400) (Request-ID:
req-401811b6-d7d0-4ce0-86a1-7cc47f904587)
# nova keypair-add --pub_key isinclair.id_rsa.pub isinclair=id_rsa
ERROR: Keypair data is invalid (HTTP 400) (Request-ID:
req-f01dc4b1-ea7f-4cc1-be9b-bc7dfc35ef56)
#
_______________________________________________
Mailing list: https://launchpad.net/~openstack
Post to : [email protected]
Unsubscribe : https://launchpad.net/~openstack
More help : https://help.launchpad.net/ListHelp