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