1
#!/usr/bin/env python2.7
2
# Copyright 2012 Canonical Ltd. This software is licensed under the
3
# GNU Affero General Public License version 3 (see the file LICENSE).
5
"""Print information from the Cobbler server."""
7
from __future__ import (
18
host = "192.168.123.2"
21
if len(sys.argv) >= 2:
23
if len(sys.argv) >= 3:
25
if len(sys.argv) >= 4:
26
password = sys.argv[3]
28
if not host.startswith('http://'):
29
host = "http://%s/cobbler_api" % host
31
server = xmlrpclib.Server(host)
32
token = server.login(user, password)
34
distros = server.get_distros()
35
print("::::::::::: distros :::::::::::")
36
for d in server.get_distros():
37
print("%s: breed=%s, os_version=%s, mgmt_classes=%s" %
38
(d['name'], d['breed'], d['os_version'], d['mgmt_classes']))
40
profiles = server.get_profiles()
41
print("\n::::::::::: profiles :::::::::::")
42
for d in server.get_profiles():
43
print("%s: distro=%s parent=%s kickstart=%s" %
44
(d['name'], d['distro'], d['parent'], d['kickstart']))
46
print("\n::::::::::: servers :::::::::::")
47
for s in server.get_systems():
48
print(s['interfaces'])