Database Reference
In-Depth Information
The assert statement does some error checking to make sure that there is at least one property name-value
pair in the propdict variable to set on the target list. self.reloadtargs = True tells the instance that the target and
properties information should be freshly queried from the database after the new target properties have been set.
__delim = '@#&@#&&' is a set of characters that should never be found in a target or property name and is used as
the delimiter in the emcli.set_target_property_value() function. __subseparator = 'property_records=' +
__delim is also used for formatting.
The first for loop iterates through the filtered target list. The second for loop iterates through the propdict
variable. Inside the second nested for loop is the emcli.set_target_property_value() function, which actually sets
the properties on each target. This set_target_property_value() function is executed once for each property per target,
so the total number of executions of this function will be the number of records in the filtered target list multiplied by
the number of property name-value pairs in propdict . As each property is set, a result is printed to the screen.
Using a class in Python requires a little extra time and effort up front, but it is well worth it. The code you work so
hard to create is scalable, extensible, and reusable. You can reuse code from any classes you create and do not have to
worry about testing them again.
Summary
Enterprise Manager is truly a powerful tool. Having a firm grasp of the functions of the graphical interface are essential
to using it effectively. EM CLI greatly enhances the ability to take advantage of all of the powerful features of EM. EM
CLI isn't the easiest thing to learn, but having the ability to script and automate activities through it offers a clear
advantage for the administrator.
Python is a powerful programming language whose maturity has been tested over the last 20-plus years. EM
CLI is written in Jython, the Java implementation of Python. Jython allows the administrator to increase their EM
effectiveness by taking advantage of the power and agility of Python alongside EM CLI.
The learning curve of any command-line tool is high, but the Python language and EM CLI are quite intuitive.
If you get stuck on syntax or functionality, help is plentiful and easy to come by. This chapter gives examples that
were created out of necessity in real-world production environments where it wasn't feasible to do these tasks
through the GUI.
The real-world environments you, the reader, will face may differ from those here, but the principals and much
of the code demonstrated in this chapter can be used to create effective and efficient solutions for the Enterprise
administrator.
 
Search WWH ::




Custom Search