From 64b35a9c3b201aed5073823fd4a15ecb15195aea Mon Sep 17 00:00:00 2001 From: Vaidas Jablonskis Date: Fri, 7 Feb 2014 13:12:48 +0000 Subject: Forgot to include _trim_key function Got removed somehow --- cloudinit/sources/DataSourceGCE.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cloudinit/sources/DataSourceGCE.py b/cloudinit/sources/DataSourceGCE.py index f9cdc1da..8a46f933 100644 --- a/cloudinit/sources/DataSourceGCE.py +++ b/cloudinit/sources/DataSourceGCE.py @@ -30,6 +30,16 @@ class DataSourceGCE(sources.DataSource): self.metadata_address = MD_URL self.metadata = {} + # GCE takes sshKeys attribute in the format of ':' + # so we have to trim each key to remove the username part + def _trim_key(self, public_key): + try: + index = public_key.index(':') + if index > 0: + return public_key[(index + 1):] + except: + return public_key + def get_data(self): # GCE metadata server requires a custom header since v1 headers = {'X-Google-Metadata-Request': True} -- cgit v1.2.3