~andreserl/+junk/cobbler

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/python

import yaml # PyYAML version
import urlgrabber
import sys

if __name__ == "__main__":
   hostname = None
   try:
      hostname = sys.argv[1]
   except:
      print "usage: cobbler-ext-nodes <hostname>"

   if hostname is not None:
       conf = open("/etc/cobbler/settings")
       config = yaml.safe_load(conf.read());
       conf.close()
       url = "http://%s:%s/cblr/svc/op/puppet/hostname/%s" % (config["server"], config["http_port"], hostname)
       print urlgrabber.urlread(url)