Forum Stats

  • 3,770,467 Users
  • 2,253,119 Discussions


Sample Jython script from Clould Control 13c documentation

User12608993-Oracle Member Posts: 1 Employee
edited May 10, 2017 7:36PM in Python


Copying sample script from Cloud Control 13c documentation:

My question from line 9: for target in l_targets.out()['data']:

l understand that l_targets is a list but what is this out method() ? Any place where it is documented? Also what is ['data']?

Looking for explanation and/or pointer to specs.


1 from emcli import *


3 search_list = ['PROPERTY_NAME=\'DBVersion\'','TARGET_TYPE= \'oracle_database

\'','PROPERTY_VALUE LIKE \'11.2%\'']


5 if len(sys.argv) == 2:

6 print login(username=sys.argv[0])

7 l_prop_val_to_set = sys.argv[1]

8 l_targets = list(resource="TargetProperties", search=search_list,


9 for target in l_targets.out()['data']:

10 t_pn = 'LifeCycle Status'

11 print "INFO: Setting Property name " + t_pn + " to value " +


12 print set_target_property_value(property_records=target['TARGET_NAME']


13 else: ]

14 print "\n ERROR: Property value argument is missing"

15 print "\n INFO: Format to run this file is <username>

<Database Target LifeCycle Status Property Value>"


  • Gaz in Oz
    Gaz in Oz Member Posts: 3,785 Bronze Crown
    edited May 10, 2017 7:36PM

    Here's an article with some detail about emcli,

    Details of "out()" (and data key) are about 3/4 the way down.

    Any function that you run in the interactive or script mode returns an object of class Response (<class ’emcli.response.Response’>). The Response class has 4 key methods:FunctionDescriptionout()Provides the verb execution output. The output can be text, or the JSON. isJson() method on the Response object can be used to determine whether the output is JSON.error()Provides the error text (if any) of the verb execution if there are any errors or exceptions during verb execution.exit_code()Provides the exit code of the verb execution. The exit code is zero for a successful execution and non-zero otherwise.isJson()Provides details about the type of output. It returns True if response.out() can be parsed into a JSON object.

    ...and here's that script explained:

    Advanced EM CLI Script Examples

This discussion has been closed.