summaryrefslogtreecommitdiffstats
path: root/scripts/cobbler-ext-nodes
blob: f9510c0d579b156c7dd4d1cf8b637b9cdfbcc517 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/usr/bin/python

from cobbler import yaml as yaml
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")
       data = conf.read()
       conf.close()
       server = yaml.load(data).next()["server"]
       url = "http://%s/cblr/svc/op/puppet/hostname/%s" % (server, hostname)
       print urlgrabber.urlread(url)