Database Reference
In-Depth Information
The __showprops() function shown in Listing 6-24 is called from the show() function in a recursive manner to
retrieve each target property defined for a target. In other words, the __showprops() function is called once for each
target defined for the instance, and the properties defined for the target are stored with it as child records.
Listing 6-24. The __showprops( ) function of the updateProps( ) class is called to retrieve the properties for each
target defined in the instance
def __showprops(self, guid):
self.__loadtargobjects()
for __inttargprops in self.targprops:
__intpropname = \
__inttargprops['PROPERTY_NAME'].split('_')
if __inttargprops['TARGET_GUID'] == guid and \
__intpropname[0:2] == ['orcl', 'gtp']:
print('%-15s%-30s%s' %
(' ', ' '.join(__intpropname[2:]).ljust(
30, '.'),
__inttargprops['PROPERTY_VALUE']))
Finally, Listing 6-25 shows the setprops() function, which is called to make the magic happen. At the point
that this function is called, the filtered target list has already been defined and the propdict dictionary variable is
populated with the property name-value pairs that will be set for the filtered target list.
Listing 6-25. The __setprops( ) function of the updateProps( ) class is called to apply the properties updates
def setprops(self, show=False):
assert len(self.propdict) > 0, \
'The propdict parameter must contain ' + \
'at least one property. Use the ' + \
'props() function to modify.'
self.reloadtargs = True
__delim = '@#&@#&&'
__subseparator = 'property_records=' + __delim
for __inttarg in self.targs:
for __propkey, __propvalue \
in self.propdict.items():
__property_records = __inttarg['TARGET_NAME'] + \
__delim + __inttarg['TARGET_TYPE'] + \
__delim + __propkey + __delim + __propvalue
print('Target: ' + __inttarg['TARGET_NAME'] +
' (' + __inttarg['TARGET_TYPE'] +
')\n\tProperty: '
+ __propkey + '\n\tValue: ' +
__propvalue + '\n')
emcli.set_target_property_value(
subseparator=__subseparator,
property_records=__property_records)
if show == True:
self.show()
 
Search WWH ::




Custom Search