Customizing the operation.json configuration file

The operation.json file defines the operations that can be called when the virtual application is running. Operations are grouped by role, and each operation is associated with a Python script, which is provided by the plug-in. Users request the operation on the Instance Console. This request is forwarded by Cloud Pak System Software for Power®, and any parameters are sent to the script on systems where the role is running. You can modify the operation.json file with the PDK JSON Editor.

Procedure

  1. If you already have the PDK JSON Editor open for your plug-in project, click the Operation tab. Otherwise,
    1. In the Project Explorer view, expand the plug-in project node.
    2. Expand the plugin folder node.
    3. Expand the appmodel folder node.
    4. Double-click the operation.json file, or right-click the file and select Open with > PDK JSON Editor.
    The Overview tab, which shows the structure and contents of the plug-in, is displayed. This tab has four sections:
    Package
    Lists the parts, node parts, and roles in the plug-in. Click Add to add a part, node part, or role to the plug-in.
    Metadata
    List the components, links, and policies in the plug-in. Click Add to create a metadata element in metadata.json.
    Runtime
    Provides links to the metadata.json, operation.json, and tweak.json files for the plug-in.
    If an item is available for editing in Eclipse, you can double-click to open it.
  2. Click the operation.json link on the Overview tab, or click the Operation tab to customize the operation.json file.
    The Operation tab shows a list of the operations for the plug-in. The name of the operation is the concatenation of the ID and role values that are associated with the operation. Using this form-based interface, you can do the following tasks:
    • Add or remove operations, specifying role and ID information, to the list of operations.

      The special configuration role defines a handler for changing configuration parameters, as specified in the tweak.json file.

    • Click an operation in the list to display and modify the following operation form details:
      • ID
      • Label
      • Description
      • Category
      • Script (the associated Python script)
        Note: Do not use exit(0) in lifecycle or operation scripts. To return an error state , set the status, such as maestro.status = 'Failed', in start.py. Using this method keeps the plug-in or software component in a controlled state so that it can be set back to RUNNING by another script after the problem is resolved.
    • Add and remove attribute types (string, number, boolean, array, file, or range)
    • Modify attribute type information, specifying ID, Label, and Description information, and whether the attribute is required.
    • Manage the order in which the attribute information is displayed in the Pattern Builder.

    Values that you specify are immediately validated, and errors, such as missing required fields, duplicate IDs, are flagged, with help tips, for correction.

    In some cases you might prefer to modify the configuration text directly, by clicking the operation.json tab to present the configuration information in a formatted text editor. Changes that are made in either the Operation user interface or the source text editor are immediately reflected in both views.