summaryrefslogtreecommitdiffstats
path: root/scripts/cobbler-ext-nodes
blob: 919bc948c9393fe3f39484034a91dedadbd00c6f (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

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