Fix way of getting computer_id

parent 79cf7086
...@@ -151,14 +151,9 @@ def suse_version(): ...@@ -151,14 +151,9 @@ def suse_version():
# Parse certificate to get computer name and return it # Parse certificate to get computer name and return it
def get_computer_name(slapos_configuration): def get_computer_name(slapos_configuration):
try: try:
conf_file=open(slapos_configuration, "r") return getSlaposConfiguration(slapos_configuration).get('slapos',
for line in conf_file: 'computer_id')
line = line.rstrip('\n') except:
if "computer_id" in line:
i = line.find("COMP-")
conf_file.close()
return line[i:]
except IOError:
print "Warning: slapos.cfg doesn't exist. Using current hostname." print "Warning: slapos.cfg doesn't exist. Using current hostname."
return socket.gethostname() return socket.gethostname()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment