Database Reference
In-Depth Information
from emcli import *
import re
# Regular expression applied to target name to filter target list
# '.*' includes all targets
# '^orcl' includes all targets that begin with 'orcl'
# '^em12cr3\.example\.com$' includes target
# with the exact name 'em12cr3.example.com'
myfiltermatch = '.*'
# Dictionary object containing the property names and values
# to be applied to the target list
myprops = {'LifeCycle Status':'Development', 'Location':'COLO'}
# When debug is enabled, commands will be printed but not executed
debug = True
# Delimiter should be something that will not appear
# in any target name
mydelim = '@'
mysubsep = 'property_records=' + mydelim
# Compile the target name filter
myreg = re.compile(myfiltermatch)
# Retrieve the full target list from the OMS
myobj = get_targets().out()['data']
# Loop through the full target list
for targ in myobj:
# If the target name filter applies...
if myreg.search(targ['Target Name']):
myproprecs = targ['Target Name'] + mydelim + \
targ['Target Type'] + mydelim
# Loop through the target properties dictionary
# for each target
for propkey, propvalue in myprops.items():
myproprecprops = propkey + mydelim + propvalue
# If debug is True, print the command to screen
# without executing
if debug:
mycommand = 'set_target_property_value(' + \
'subseparator="' + mysubsep + \
'", property_records="' + \
myproprecs + \
myproprecprops + '")'
print(mycommand)
Search WWH ::




Custom Search