Comment 1 for bug 432773

Revision history for this message
Etienne Goyer (etienne-goyer-outlands) wrote :

After investigation (thanks Marc!), it seems like Eucalyptus add a trailing newline to the output of http://169.254.169.254/2008-02-01/meta-data/public-keys/. That confuse ec2-fetch-credentials; adding a check for empty newline in get_ssh_keys() actually fix the bug, such as:

def get_ssh_keys():
    base_url = 'http://169.254.169.254/%s/meta-data' % api_ver
    data = urllib.urlopen('%s/public-keys/' % base_url).read()
    keyids = [line.split('=')[0] for line in data.split('\n') if line] <-- *** That is where to check for empty line ***
    return [urllib.urlopen('%s/public-keys/%d/openssh-key' % (base_url, int(keyid))).read().rstrip() for keyid in keyids]