~lutostag/ubuntu/utopic/maas/1.5.2

« back to all changes in this revision

Viewing changes to vdenv/api-list.py

  • Committer: Package Import Robot
  • Author(s): Andres Rodriguez
  • Date: 2012-03-15 18:14:08 UTC
  • mfrom: (1.1.3)
  • Revision ID: package-import@ubuntu.com-20120315181408-zgl94hzo0x4n99an
Tags: 0.1+bzr295+dfsg-0ubuntu2
* debian/patches:
  - 01-fix-database-settings.patch: Update to set PSERV_URL.
  - 02-pserv-config.patch: Set port to 8001.
* debian/maas.postinst: Run maas-import-isos on install.
* debian/control: Depends on rabbitmq-server.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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).
 
4
 
 
5
"""Print information from the Cobbler server."""
 
6
 
 
7
from __future__ import (
 
8
    print_function,
 
9
    unicode_literals,
 
10
    )
 
11
 
 
12
__metaclass__ = type
 
13
 
 
14
import sys
 
15
import xmlrpclib
 
16
 
 
17
 
 
18
host = "192.168.123.2"
 
19
user = "cobbler"
 
20
password = "cobbler"
 
21
if len(sys.argv) >= 2:
 
22
    host = sys.argv[1]
 
23
if len(sys.argv) >= 3:
 
24
    user = sys.argv[2]
 
25
if len(sys.argv) >= 4:
 
26
    password = sys.argv[3]
 
27
 
 
28
if not host.startswith('http://'):
 
29
    host = "http://%s/cobbler_api" % host
 
30
 
 
31
server = xmlrpclib.Server(host)
 
32
token = server.login(user, password)
 
33
 
 
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']))
 
39
 
 
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']))
 
45
 
 
46
print("\n::::::::::: servers :::::::::::")
 
47
for s in server.get_systems():
 
48
    print(s['interfaces'])