<commit_before>#!/usr/bin/python
import sys
import os
import socket
sys.stderr = sys.stdout
print "Content-Type: text/plain"
print

try:
  # from the name, e.g. c1-3 take c1-3
  hostname = socket.gethostbyaddr(os.environ["REMOTE_ADDR"])[0].split(".")[0]

  os.stat("/var/www/provision/reinstall/" + hostname)
  os.remove("/var/www/provision/reinstall/" + hostname)
  f = open("/var/www/provision/nodes/" + hostname + ".conf")
  nodesettings = {}
  for line in f.readlines():
    #for every line, e.g. "key=value", set nodesettings["key"]="value"
    #comment lines will throw an error, skip them
    try:
      nodesettings[line.split("=")[0]] = line.split("=")[1].strip()
    except:
      pass

  f.close()

  print "#!ipxe"
  print "kernel http://" + nodesettings["kickstart_server_ip"] + "/ks/vmlinuz ks=http://" + nodesettings["kickstart_server_ip"] + "/ks/" + nodesettings["kickstart_profile"] + " edd=off ksdevice=bootif kssendmac console=ttyS1,115200 console=tty0 initrd=initrd.img"
  print "initrd http://" + nodesettings["kickstart_server_ip"] + "/ks/initrd.img"
  print "boot"

except:
   print "#!ipxe"
   print "exit"
<commit_msg>Allow serial port to be chosen, default to ttyS0<commit_after>#!/usr/bin/python
import sys
import os
import socket
sys.stderr = sys.stdout
print "Content-Type: text/plain"
print

try:
  # from the name, e.g. c1-3 take c1-3
  hostname = socket.gethostbyaddr(os.environ["REMOTE_ADDR"])[0].split(".")[0]

  os.stat("/var/www/provision/reinstall/" + hostname)
  os.remove("/var/www/provision/reinstall/" + hostname)
  f = open("/var/www/provision/nodes/" + hostname + ".conf")
  nodesettings = {}
  for line in f.readlines():
    #for every line, e.g. "key=value", set nodesettings["key"]="value"
    #comment lines will throw an error, skip them
    try:
      nodesettings[line.split("=")[0]] = line.split("=")[1].strip()
    except:
      pass

  f.close()

  serialport = 'ttyS0'
  if 'serialport' in nodesettings:
    serialport = nodesettings['serialport']

  print "#!ipxe"
  print "kernel http://" + nodesettings["kickstart_server_ip"] + "/ks/vmlinuz ks=http://" + nodesettings["kickstart_server_ip"] + "/ks/" + nodesettings["kickstart_profile"] + " edd=off ksdevice=bootif kssendmac console=" + serialport + ",115200 console=tty0 initrd=initrd.img"
  print "initrd http://" + nodesettings["kickstart_server_ip"] + "/ks/initrd.img"
  print "boot"

except:
   print "#!ipxe"
   print "exit"

{'fraction_non_alphanumeric': 0.17316372589249077, 'fraction_numerical': 0.013541239228559704, 'mean_word_length': 4.100418410041841, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2521700', 'n_tokens_mistral': 911, 'n_tokens_neox': 867, 'n_words': 190}