Database Reference
In-Depth Information
Once there is a file containing the code, we can use this code to update the properties of Enterprise Manager
targets. Start a session of EM CLI and establish a login to the OMS.
Using the updateProps( ) Class
Listing 6-12 shows an example of how to use the updateProps() class to update the properties of some EM CLI
targets. The class is doing exactly what the commands did in the previous section, but you will notice how much less
code is required.
Listing 6-12. Import and use the updateProps( ) class to change target properties
emcli>import updateProps
emcli>myinst = updateProps.updateProps()
emcli>myinst.props({'LifeCycle Status':'Development'})
emcli>myinst.filt(namefilter='^em12cr3.example.com$', typefilter='host')
emcli>myinst.show()
TARGET_TYPE.............................TARGET_NAME
PROPERTY_NAME.................PROPERTY_VALUE
================================================================================
host....................................em12cr3.example.com
target version................6.4.0.0.0
os............................Linux
platform......................x86_64
emcli>myinst.setprops(show=True)
Target: em12cr3.example.com (host)
Property: LifeCycle Status
Value: Development
TARGET_TYPE.............................TARGET_NAME
PROPERTY_NAME.................PROPERTY_VALUE
================================================================================
host....................................em12cr3.example.com
target version................6.4.0.0.0
os............................Linux
platform......................x86_64
lifecycle status..............Development
The example in Listing 6-12 updated one property for one target. The updateProps() class is capable of updating
any number of properties for any number of targets. Listing 6-13 expands on the previous example by updating
additional properties of the same target.
 
Search WWH ::




Custom Search