fixed missing colon in if statement

This commit is contained in:
Jakobus Schürz 2019-07-31 12:42:09 +02:00
parent 72b551f6b0
commit 0b35036df6

View file

@ -33,7 +33,7 @@ class InsecureSSHKeyUsername(Exception):
return '%s: %s' % (self.__doc__, ': '.join(self.args)) return '%s: %s' % (self.__doc__, ': '.join(self.args))
def ssh_extract_user(pubkey): def ssh_extract_user(pubkey):
if re.search(r"\s", pubkey) if re.search(r"\s", pubkey):
_, user = pubkey.rsplit(None, 1) _, user = pubkey.rsplit(None, 1)
else: else:
user = pubkey user = pubkey
@ -134,7 +134,7 @@ class Main(app.App):
log.info('Reading SSH public key...') log.info('Reading SSH public key...')
pubkey = read_ssh_pubkey() pubkey = read_ssh_pubkey()
user = ssh_extract_user(pubkey) user = ssh_extract_user(pubkey)
if not re.search(r"\s", pubkey) if not re.search(r"\s", pubkey):
pubkey = None pubkey = None
if user is None: if user is None:
log.error('Cannot parse user from SSH public key.') log.error('Cannot parse user from SSH public key.')