fix node and installation id whitespace bugs

This commit is contained in:
Jack Robison 2017-12-29 14:08:40 -05:00
parent 62a8789393
commit ecb9909faa
No known key found for this signature in database
GPG key ID: 284699E7404E3CFF

View file

@ -566,7 +566,7 @@ class Config(object):
if not self._installation_id: if not self._installation_id:
if os.path.isfile(install_id_filename): if os.path.isfile(install_id_filename):
with open(install_id_filename, "r") as install_id_file: with open(install_id_filename, "r") as install_id_file:
self._installation_id = install_id_file.read() self._installation_id = str(install_id_file.read()).strip()
if not self._installation_id: if not self._installation_id:
self._installation_id = base58.b58encode(utils.generate_id()) self._installation_id = base58.b58encode(utils.generate_id())
with open(install_id_filename, "w") as install_id_file: with open(install_id_filename, "w") as install_id_file:
@ -578,7 +578,7 @@ class Config(object):
if not self._node_id: if not self._node_id:
if os.path.isfile(node_id_filename): if os.path.isfile(node_id_filename):
with open(node_id_filename, "r") as node_id_file: with open(node_id_filename, "r") as node_id_file:
self._node_id = base58.b58decode(node_id_file.read()) self._node_id = base58.b58decode(str(node_id_file.read()).strip())
if not self._node_id: if not self._node_id:
self._node_id = utils.generate_id() self._node_id = utils.generate_id()
with open(node_id_filename, "w") as node_id_file: with open(node_id_filename, "w") as node_id_file: