~ubuntu-branches/ubuntu/quantal/xen-api/quantal

« back to all changes in this revision

Viewing changes to ocaml/idl/binding_sanity_checks/tutorial_examples/nagios_snippet2.py

  • Committer: Package Import Robot
  • Author(s): Jon Ludlam
  • Date: 2011-07-07 21:50:18 UTC
  • Revision ID: package-import@ubuntu.com-20110707215018-3t9ekbh7qy5y2b1p
Tags: upstream-1.3
ImportĀ upstreamĀ versionĀ 1.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
hostname, username, password = "ivory", "root", "password"
 
2
 
 
3
import XenAPI
 
4
 
 
5
try:
 
6
    session=XenAPI.Session('https://'+hostname)
 
7
    session.login_with_password(username, password)
 
8
except XenAPI.Failure, e:
 
9
    if e.details[0]=='HOST_IS_SLAVE':
 
10
        session=XenAPI.Session('https://'+e.details[1])
 
11
        session.login_with_password(username, password)
 
12
    else:
 
13
        raise
 
14
 
 
15
sx=session.xenapi