From 9967bc76410b7ecddc6d02411cd3bda08a5a7b9a Mon Sep 17 00:00:00 2001 From: Kim Hagen Date: Tue, 23 Oct 2018 23:36:27 +0200 Subject: Use dhcp for google cloud source Rework check to see which part of ssh key is which --- cloudinit/config/cc_vyos.py | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'cloudinit/config') diff --git a/cloudinit/config/cc_vyos.py b/cloudinit/config/cc_vyos.py index b073239c..290d3665 100644 --- a/cloudinit/config/cc_vyos.py +++ b/cloudinit/config/cc_vyos.py @@ -20,7 +20,6 @@ import os import sys -import base64 import ast from cloudinit import util @@ -58,11 +57,9 @@ def set_ssh_login(config, user, key_string, key_x): for key in key_parts: if 'ssh-dss' in key or 'ssh-rsa' in key: key_type = key - try: - if base64.b64decode(key): - key_data = key - except: - pass + + if key.startswith('AAAAB3NzaC1yc2E') or key.startswith('AAAAB3NzaC1kc3M'): + key_data = key if not key_type: util.logexc(log, 'Key type not defined, wrong ssh key format.') -- cgit v1.2.3