Skip to content

Commit c760358

Browse files
committed
library/ssh_cert.py: make it works with python3
Mainly string vs bytes-string issues. Compatibility with Python 2.x now broken.
1 parent d361806 commit c760358

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

library/ssh_cert.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#! /usr/bin/env python
1+
#! /usr/bin/env python3
22

33
from datetime import datetime
44
import string
@@ -45,7 +45,7 @@ def not_valid(cert_timestamps):
4545
def cert_type(lines):
4646
for l in lines:
4747
if l.startswith('Type'):
48-
return string.split(l, maxsplit=2)[1:]
48+
return l.split(maxsplit=2)[1:]
4949

5050

5151
def valid_from(lines):
@@ -79,7 +79,7 @@ def main():
7979
'-f', result['ca']['path'],
8080
])
8181

82-
ca_lines = string.split(ca_output, maxsplit=2)
82+
ca_lines = ca_output.decode().split(maxsplit=2)
8383
result['ca']['fingerprint'] = ca_lines[1]
8484
result['ca']['comment'] = ca_lines[2]
8585

@@ -88,7 +88,7 @@ def main():
8888
'-L',
8989
'-f', result['certificate']['path'],
9090
])
91-
cert_lines = [line.strip() for line in cert_output.split('\n')]
91+
cert_lines = [line.strip() for line in cert_output.decode().split('\n')]
9292

9393
result['certificate']['signin_ca'] = signin_ca(cert_lines)
9494
result['certificate']['valid'] = {

0 commit comments

Comments
 (0)