|
|
@ -96,12 +96,21 @@ class Ec2Metadata(object):
|
|
|
|
else:
|
|
|
|
else:
|
|
|
|
self._data['%s' % (new_uri)] = content
|
|
|
|
self._data['%s' % (new_uri)] = content
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def fix_invalid_varnames(self, data):
|
|
|
|
|
|
|
|
"""Change ':'' and '-' to '_' to ensure valid template variable names"""
|
|
|
|
|
|
|
|
for (key, value) in data.items():
|
|
|
|
|
|
|
|
if ':' in key or '-' in key:
|
|
|
|
|
|
|
|
newkey = key.replace(':','_').replace('-','_')
|
|
|
|
|
|
|
|
data[newkey] = value
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def run(self):
|
|
|
|
def run(self):
|
|
|
|
self.fetch(self.uri_meta) # populate _data
|
|
|
|
self.fetch(self.uri_meta) # populate _data
|
|
|
|
data = self._mangle_fields(self._data,
|
|
|
|
data = self._mangle_fields(self._data,
|
|
|
|
self.uri_meta)
|
|
|
|
self.uri_meta)
|
|
|
|
data[self._prefix % 'user-data'] = self._fetch(self.uri_user)
|
|
|
|
data[self._prefix % 'user-data'] = self._fetch(self.uri_user)
|
|
|
|
data[self._prefix % 'public-key'] = self._fetch(self.uri_ssh)
|
|
|
|
data[self._prefix % 'public-key'] = self._fetch(self.uri_ssh)
|
|
|
|
|
|
|
|
self.fix_invalid_varnames(data)
|
|
|
|
return data
|
|
|
|
return data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|