Skip to main content

Summary This article clarifies how to write Tcl scripts that incorporate itadmin commands and handle errors from these itadmin commands.
Environment

Orbix 6.3.*

All Supported Operating Systems

Question/Problem Description How to add error handling to a Tcl script used by itadmin.
Clarifying Information itadmin lets you manage information used by Orbix services. You can use itadmin in various modes and contexts:
  • Command-line utility
  • Command shell
  • Tcl script
  • Transactions

You can write your own Tcl scripts that incorporate itadmin commands. For example, you could develop a Tcl script called my_script that contains one itadmin command per line. You would invoke this script by entering:

itadmin my_script.tcl

Incorporating itadmin commands in reusable Tcl scripts provides an extremely powerful way of automating administration tasks (for example, populating a configuration domain or location domain).

Error Message
Defect/Enhancement Number
Cause
Resolution

When writing Tcl scripts using multiple itadmin command it is highly recommended to use an exception handler for each itadmin command.

Below is an example of such an exception handler:

# do_cmd installs an exception handler for each itadmin command

proc do_cmd {cmd} {
  set fail [catch {eval $cmd} result]
  if {$fail} {
    puts stderr "Problem in \\"$cmd\\": $result"
    flush stderr
    exit 1
  }
}

# Each itadmin command is sent as a parameter to do_cmd
do_cmd {variable create -type string -value poa
initial_references:RootPOA:plugin}
do_cmd {variable create -type string -value poa
initial_references:POACurrent:plugin}
do_cmd {variable modify ... }
do_cmd {poa create ...}
exit 0

The do_cmd procedure installs an exception handler for each itadmin command.
Each itadmin command is in turn sent as a parameter to do_cmd. For example, the first call to do_cmd creates initial_references:RootPOA:plugin and assigns it a value of poa.

For further details on using the itadmin command, please see the Orbix "Administratior's Guide", chapter "Managing Orbix Services With itadmin", section "Using itadmin", available below:

http://supportline.microfocus.com/productdoc.aspx

by selecting

Product family: CORBA Middleware
Product: Orbix
Release: 6.36

Workaround
Notes
Attachment

#Orbix
#KnowledgeDocs