Comment 16 for bug 1068801

Revision history for this message
Tomas Karasek (tomas-karasek) wrote :

hi, I am testing 0.7.0 on Scientific Linux CERN 6 (clone of RHEL6), with python-boto-2.5.2-1.el6.noarch. I build the rpm for cloud-init from trunk, revno 725. My isntances live in Openstack Essex. Python is 2.6.6.

My .ssh/authorized_keys are still not populated.

I debugged through sources/__init__.py, function normalize_pubkey_data(pubkey_data). So following text regards the function.
When I print the type of pubkey_data, it's <class 'boto.utils.LazyLoadMetadata'>. When I print the pubkey_data itself, the object gets evaluated and .ssh/authorized_keys are populated properly. In that case the pubkey_data are a dict:

{'tkarasek_keypair': ['ssh-rsa AAAAB3NzaD1yc2EAAAABIwAAAIEAutjuZ/3b+eY3VvKWJPsgkfJqcjKaobgjJRbr/jCwskGUNc8nGdB3dhOJTFTUi/gycrT8CeebB/wwwM4oz3ip/GJjCPaHS8X4vkqWsqgBQZ36cNzfRnqwKWRTMzAI19ekTIsOdjENyeQ+QJoyOFIU9RJAOoepEp/uMD3PH39FLfk= sth@lhost, '']}

Even if I don't print the pubkey_data, it takes the last branch ("if isinstance(pubkey_data, (dict)):"). However in the loop over iteritems of the dict, I get ('tkarasek_keypair', None), i.e. the value of pubkey_data['tkarasek_keypair'] is reported as None. Because of that, empty list is returned from normalize_pubkey_data.

When I change the loop to
for (_keyname, klist) in pubkey_data.items(): # isntead of for (_keyname, klist) in pubkey_data.iteritems()

I get the proper list in klist and my authorized keys are populated. It seems the iterator doesnt work well with the boto lazy metadata.

Would you change the loop from iteritems to items?