Database Reference
In-Depth Information
Now we are seeing just the targets we want to modify. Let's add in the command to change the properties.
However, instead of running the commands blindly, we'll just print the command that the loop would have run to
make sure the commands are what we want without actually affecting the targets:
emcli>for targ in myobj:
... if myreg.search(targ['Target Name']):
... mycommand = 'set_target_property_value(' + \
... 'property_records="' + \
... targ['Target Name'] + ':' + \
... targ['Target Type'] + \
... ':LifeCycle Status:Development")'
... print(mycommand)
set_target_property_value(property_records="TEST_em12cr3.example.com:host:LifeCycle
Status:Development")
set_target_property_value(property_records="TEST_em12cr3.example.com:3872:oracle_emd:LifeCycle
Status:Development")
The set_target_property_value() function commands are printed to the screen. These commands can then be
copied and pasted within the same EM CLI session:
emcli>set_target_property_value(property_records="TEST_em12cr3.example.com:host:LifeCycle
Status:Development")
Properties updated successfully
However, a problem pops up immediately if we try to run the command for an agent target:
emcli>set_target_property_value(property_records="TEST_em12cr3.example.com:3872:oracle_emd:LifeCycle
Status:Development")
Syntax Error: Invalid value for parameter "INVALID_RECORD_ERR":
"em12cr3.example.com:3872:oracle_emd:LifeCycle Status:Development"
The target name TEST_em12cr3.example.com:3872 contains the default delimiter, the colon character, which
means we need to include another parameter in the set_target_property_value() function to change the delimiter.
The subseparator parameter will change the character that separates the different parts of the property_records
parameter from a colon to an @ sign. Notice the addition of the mysubsep and myproprecs variables:
emcli>for targ in myobj:
... if myreg.search(targ['Target Name']):
... mysubsep = 'property_records=@'
... myproprecs = targ['Target Name'] + \
... '@' + targ['Target Type'] + \
... '@LifeCycle Status@Development'
... mycommand = 'set_target_property_value(' + \
... 'subseparator="' + \
... mysubsep + '", property_records="' + \
... myproprecs + '")'
... print(mycommand)
set_target_property_value(subseparator="property_records=@", property_records=" TEST_em12cr3.
example.com@host@LifeCycle Status@Development")
set_target_property_value(subseparator="property_records=@", property_records=" TEST_em12cr3.
example.com:3872@oracle_emd@LifeCycle Status@Development")
Search WWH ::




Custom Search