Accessing a RAD Remote Property in Python

The following example shows how to access a remote property.

Example 2-42 Python Language – Accessing a Remote RAD Property

>>> import rad.bindings.com.oracle.solaris.rad.zonemgr as zonemgr
>>> import rad.client as radc
>>> import rad.connect as radcon
>>> with radcon.connect_unix() as rc:
...     name = rc.list_objects(zonemgr.Zone(), radc.ADRGlobPattern({"name" : "test-0"}))
...     zone = rc.get_object(name[0])
...     for prop in zone.getResourceProperties(zonemgr.Resource("global")):
...         if prop.name == "brand":
...             print "Zone: %s, brand: %s" % (zone.name, prop.value)
...             break
... 
Zone: test-0, brand: solaris
>>>

In this example, you have accessed the list of global resource properties of the Zone and searched the list of properties for the brand property. When you find it, print the value of the brand property and then terminate the loop.