diff --git a/slapprepare/slapprepare/slapprepare.py b/slapprepare/slapprepare/slapprepare.py index 8fb8e8ad79ffa62076383c1085a2dfd0c7c35462..0ead704370bf9e11c35ed83b9f55e5b34cd35b6a 100644 --- a/slapprepare/slapprepare/slapprepare.py +++ b/slapprepare/slapprepare/slapprepare.py @@ -152,14 +152,9 @@ def suse_version(): # Parse certificate to get computer name and return it def get_computer_name(slapos_configuration): try: - conf_file=open(slapos_configuration, "r") - for line in conf_file: - line = line.rstrip('\n') - if "computer_id" in line: - i = line.find("COMP-") - conf_file.close() - return line[i:] - except IOError: + return getSlaposConfiguration(slapos_configuration).get('slapos', + 'computer_id') + except: print "Warning: slapos.cfg doesn't exist. Using current hostname." return socket.gethostname()