ec2-fetch-credentials do not work in jaunty instance being run on Eucalyptus
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
cloud-init (Ubuntu) |
Invalid
|
Undecided
|
Unassigned | ||
ec2-init (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
Binary package hint: ec2-init
It seems like the command ec2-fetch-
ubuntu@ubuntu:~$ wget http://
--2009-09-18 17:55:29-- http://
Connecting to 169.254.
[...snip wget output...]
2009-09-18 17:55:29 (1.98 MB/s) - `index.html' saved [19]
ubuntu@ubuntu:~$ cat index.html
0=warthogs-dba-key
ubuntu@ubuntu:~$ ec2-fetch-
Traceback (most recent call last):
File "/usr/sbin/
keys = get_ssh_keys()
File "/usr/sbin/
return [urllib.
ValueError: invalid literal for int() with base 10: ''
Changed in cloud-init (Ubuntu): | |
status: | New → Invalid |
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.