1 //%LICENSE////////////////////////////////////////////////////////////////
3 // Licensed to The Open Group (TOG) under one or more contributor license
4 // agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
5 // this work for additional information regarding copyright ownership.
6 // Each contributor licenses this file to you under the OpenPegasus Open
7 // Source License; you may not use this file except in compliance with the
10 // Permission is hereby granted, free of charge, to any person obtaining a
11 // copy of this software and associated documentation files (the "Software"),
12 // to deal in the Software without restriction, including without limitation
13 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 // and/or sell copies of the Software, and to permit persons to whom the
15 // Software is furnished to do so, subject to the following conditions:
17 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software.
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23 // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24 // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 //////////////////////////////////////////////////////////////////////////
30 //%/////////////////////////////////////////////////////////////////////////////
33 This module contains main() for cimcli.
34 It executes the setup,
35 input parameter analysis
36 directly for the object definition (second parameter)
37 other parameters through CIMCLIOptions
39 calling the proper action function per the input operation
43 output of summary information
44 output of timing information
45 Legal operation are defined in CIMCLIOperations. Legal input parameters
46 are defined in CIMCLIOptions.
48 #include <Pegasus/Common/Config.h>
49 #include <Pegasus/Common/PegasusAssert.h>
50 #include <Pegasus/Common/Constants.h>
51 #include <Pegasus/Common/Threads.h>
52 #include <Pegasus/Common/Tracer.h>
53 #include <Pegasus/Common/HostLocator.h>
55 #include <Pegasus/Client/CIMClient.h>
56 #include <Pegasus/General/Stopwatch.h>
58 #include <Clients/cimcli/CIMCLIClient.h>
59 #include <Clients/cimcli/CIMCLIHelp.h>
60 #include <Clients/cimcli/CIMCLIOptions.h>
61 #include <Clients/cimcli/CIMCLIOperations.h>
64 #include <Pegasus/General/SetFileDescriptorToEBCDICEncoding.h>
67 PEGASUS_USING_PEGASUS;
70 /////////////////////////////////////////////////////////////////////////
72 // The following functions process the target object parameter for
73 // particular action functions.
75 //////////////////////////////////////////////////////////////////////////
77 /** getClassNameInput - gets the classname object
78 * and puts in into the opts.className holder
79 * If rqd, parameter must exist and error generated if it does
80 * not exist. Otherwise it subsitutes NULL for the string. Also
81 * puts the arguement in inputObjectName for possible error
83 * @param argc number of input arguments. Used to determine if
84 * required argument exits
85 * @param argv List of input arguments. Argument for conversion
86 * to classname is in this list.
87 * @param opts Options Structure reference. Puts results into
89 * @param- rqd - true if parameter required
90 * @return True if parameter found. False if parameter not
91 * required and required.
93 Boolean _getClassNameInput(int argc, char** argv, Options& opts, Boolean rqd)
97 opts.inputObjectName = argv[2];
100 opts.className = CIMName(argv[2]);
105 cerr << "Error: Input class name invalid."
106 << endl << e.getMessage() << endl
107 << "Must be the class Name as defined by DMTF Spec."
108 << " Input Probably contains invalid character. "
110 exit(CIMCLI_RTN_CODE_PEGASUS_EXCEPTION);
113 else // Parameter does not exist
115 opts.inputObjectName = "";
118 cerr << "Error: Class Name Required. ex. gc CIM_Door" << endl;
121 else // set the opts properties to indicate no classname input
123 opts.className = CIMName();
128 /** getObjectName - gets the objectname object
129 * and puts in into the opts.className holder
130 * If rqd, parameter must exist. Otherwise
131 * it subsitutes NULL for the string.
132 * Also puts the argument in inputObjectName for possible error
134 * @param argc number of input arguments. Used to determine if
135 * required argument exits
136 * @param argv List of input arguments. Argument for conversion
137 * to classname is in this list.
138 * @param opts Options Structure reference. Puts results into
140 * @param- rqd - true if parameter required
141 * @return True if parameter found.
143 Boolean _getObjectNameInput(int argc, char** argv, Options& opts, Boolean rqd)
147 opts.inputObjectName = argv[2]; // save for possible eror report
150 opts.targetObjectName = argv[2];
154 cerr << "Error: Input ObjectPath formatted incorrectly."
155 << endl << e.getMessage() << endl
156 << "Must be model path defined by DMTF Spec."
158 exit(CIMCLI_RTN_CODE_PEGASUS_EXCEPTION);
163 opts.inputObjectName = "";
166 cerr << "Error: Object Name Required" << endl;
171 opts.targetObjectName = CIMObjectPath();
177 /** _getQualifierNameInput - Gets a single parameter for
178 * qualifier. Puts input into inputObjectName for possible error
180 * @return true if parameter found
182 Boolean _getQualifierNameInput(int argc, char** argv, Options& opts)
186 opts.qualifierName = argv[2];
187 opts.inputObjectName = argv[2];
191 cerr << "Qualifier Name Required" << endl;
198 Function to handle Client Operation Performance data if the
199 server returns this data.
200 FUTURE - This code still caries some of the tests that were
201 initally implemented when the callback was first created. We should
202 explore removing or modifying these tests. At least partly fixed by
203 making the displays conditional on verboseTest
205 bool _localVerboseTest;
206 ClientOpPerformanceData returnedPerformanceData;
207 class ClientStatistics : public ClientOpPerformanceDataHandler
211 virtual void handleClientOpPerformanceData (
212 const ClientOpPerformanceData & item)
214 // NOTE: We do not use this value so testing it is only a
215 // diagnostic function.
216 // FUTURE - Should test against operation we are expecting
217 if (!(0 <= item.operationType) || !(39 >= item.operationType) &&
220 cerr << "Error:Operation type out of expected range in"
221 " ClientOpPerformanceData "
225 returnedPerformanceData.operationType = item.operationType;
226 if ((item.roundTripTime == 0) && _localVerboseTest)
228 cerr << "Error: roundTripTime incorrect (0) in"
229 " ClientOpPerformanceData. "
232 returnedPerformanceData.roundTripTime = item.roundTripTime;
234 if ((item.requestSize == 0) && _localVerboseTest)
236 cerr << "Error:requestSize incorrect (0) in"
237 " ClientOpPerformanceData "
240 returnedPerformanceData.requestSize = item.requestSize;
242 if ((item.responseSize == 0) && _localVerboseTest)
244 cerr << "Error:responseSize incorrect (0)"
245 " in ClientOpPerformanceData "
248 returnedPerformanceData.responseSize = item.responseSize;
250 if (item.serverTimeKnown)
252 /* Bypass this because we are getting server times zero
253 if (item.serverTime == 0)
255 cerr << "serverTime is incorrect in ClientOpPerformanceData "
259 returnedPerformanceData.serverTime = item.serverTime;
260 returnedPerformanceData.serverTimeKnown = item.serverTimeKnown;
261 returnedPerformanceData.roundTripTime = item.roundTripTime;
266 ///////////////////////////////////////////////////////////////////////
270 ///////////////////////////////////////////////////////////////////////
272 int main(int argc, char** argv)
274 //****** Show the args diagnostic display *******
275 // This is developer tool to sort out issues of incoming parameters
276 // Activated by making the last argument the keyword "displaycliargs".
277 // It displays all args and then eliminates argv[argc] so the proces
279 if (strcmp(argv[argc - 1],"displaycliargs") == 0)
281 cout << "argc = " << --argc << endl;
282 for (int i = 0; i < argc; i++)
284 cout << "argv[" << i << "] = " << argv[i] << endl;
288 #ifdef PEGASUS_OS_ZOS
289 // for z/OS set stdout and stderr to EBCDIC
290 setEBCDICEncoding(STDOUT_FILENO);
291 setEBCDICEncoding(STDERR_FILENO);
294 #ifdef PEGASUS_OS_PASE
295 // Allow user group name larger than 8 chars in PASE environemnt
296 setenv("PASE_USRGRP_LIMITED","N",1);
299 // If no arguments, simply print usage message and terminate.
300 MessageLoader::_useProcessLocale = true;
308 // Get options (from command line and from configuration file); this
309 // removes corresponding options and their arguments from the command
314 // Define the options structure. Common structure used for all action
318 // Execute the following in a try block since there are several
319 // possibilities of exception and we want to separate these very basic
320 // exceptions from the action function exceptions. Exceptions in this
321 // block are probably due to programming errors or very strange things
325 // Set the path for the config file.
326 //assume that the config file is local to directory where called.
328 String testHome = ".";
329 om.setMessagePath("pegasus/pegasusCLI");
331 // Build the options table based on the options defined in the
332 // function, a configuration file if it exists, and the command
333 // line input of options.
334 BuildOptionsTable(om, argc, argv, testHome);
336 // Parse and validate input Options based on the options table
337 CheckCommonOptionValues(om, argv, opts);
339 // move any other input parameters left to the valueParams List
341 /* FUTURE: note that this is in too limited since it assumes a fixed
342 number of parameters will be used for all of the commands
343 It should be expanded to allow for a variable minimum
344 number of commands before it picks up any extras.
348 for (int i = 2 ; i < argc ; i++ )
350 opts.valueParams.append(argv[i]);
354 catch(CIMException& e)
356 cerr << argv[0] << " Caught CIMException during init: "
357 << "\n" << e.getMessage()
364 cerr << argv[0] << ": Caught Exception during init. "
365 << e.getMessage() << endl;
366 exit(CIMCLI_RTN_CODE_PEGASUS_EXCEPTION);
370 cerr << argv[0] << " Caught General Exception During Init:" << endl;
371 exit(GENERAL_CLI_ERROR_CODE);
374 // if there is an arg1, assume it is the command name.
378 opts.cimCmd = argv[1];
382 cerr << "Error: P[eration name must be first or --c parameter."
383 << " \n ex. cli enumerateclasses\n"
384 << "Enter " << argv[0] << " -h for help."
386 exit(CIMCLI_INPUT_ERR);
389 // if the trace option was set initialize the trace function.
393 const char* tmpDir = getenv ("PEGASUS_TMP");
398 String traceFile (tmpDir);
399 traceFile.append("/cliTrace.trc");
400 Tracer::setTraceFile (traceFile.getCString());
401 Tracer::setTraceComponents("ALL");
402 Tracer::setTraceLevel(opts.trace);
405 if (opts.verboseTest && opts.debug)
407 cout << "Command = " << opts.cimCmd << endl;
410 // Find the command or the shortcut name input.
412 Operations thisOperation;
414 if (!thisOperation.find(opts.cimCmd))
416 cerr << "Error: Invalid cimcli operation name. "
417 "Operation name must be first parmeter"
419 << " \n ex. cli enumerateclasses\n"
420 << "Enter " << argv[0] << " -h for help."
422 exit(GENERAL_CLI_ERROR_CODE);
425 // Start the time for total elapsed time for the command
426 Stopwatch totalElapsedExecutionTime;
427 totalElapsedExecutionTime.start();
430 // Try to open the connection to the cim server
435 if (thisOperation.get().ID_Operation != ID_ShowOptions)
440 if (opts.location != String::EMPTY)
442 addr.setHostLocator(opts.location);
445 throw InvalidLocatorException(opts.location);
447 host = addr.getHost();
450 Uint32 portNumber = System::lookupPort( WBEM_HTTP_SERVICE_NAME,
451 WBEM_DEFAULT_HTTP_PORT );
453 // Set up SSL port and flag for verbose display
454 // if SSL included in build
456 #ifdef PEGASUS_HAS_SSL
459 portNumber = System::lookupPort( WBEM_HTTPS_SERVICE_NAME,
460 WBEM_DEFAULT_HTTPS_PORT );
463 useSSL.append((opts.ssl)? "true" : "false");
466 if (host != String::EMPTY && addr.isPortSpecified())
468 portNumber = addr.getPort();
471 //check whether we should use connect() or connectLocal()
472 //an empty location option indicates to use connectLocal()
473 if (String::equal(host, String::EMPTY))
475 if (opts.verboseTest)
477 cout << "Connect with connectLocal" << endl;
479 opts.client.connectLocal();
483 if (opts.verboseTest)
485 cout << "Connect to " << host
486 << " port=" << portNumber
488 << " for User=" << opts.user
492 // Connect with SSL api only if SSL compile enabled
493 #ifdef PEGASUS_HAS_SSL
494 String sslRndFilePath = "sss.rnd";
495 if (opts.ssl) //connect over HTTPS
497 if (!String::equal(opts.clientCert, String::EMPTY)
498 && !String::equal(opts.clientKey, String::EMPTY))
500 if (opts.verboseTest)
502 cout << "SSL options "
503 << "CertPath = " << opts.clientCert
504 << "clientKeyPath = "
505 << opts.clientKey << endl;
507 opts.client.connect(host,
512 NULL, sslRndFilePath),
517 opts.client.connect(host,
519 SSLContext("", NULL, sslRndFilePath),
523 } else //connect over HTTP
525 opts.client.connect(host, portNumber, opts.user,
529 opts.client.connect(host, portNumber, opts.user,
533 } // end if if not show options.
537 cerr << "Pegasus Exception: " << e.getMessage() <<
538 " Trying to connect to " << opts.location << endl;
539 exit(CIMCLI_CONNECTION_FAILED);
542 // Register for Client statistics which might be returned with
544 ClientStatistics statistics = ClientStatistics();
545 _localVerboseTest = opts.verboseTest;
546 opts.client.registerClientOpPerformanceDataHandler(statistics);
548 // if delay option set, execute this delay between the connect and the
549 // execution of the command.
550 // NOTE: This was a test option for some specific tests
551 // FUTURE: Consider removing this option.
554 Threads::sleep(opts.delay * 1000);
557 // If the timeout is not zero, set the timeout for this connection.
558 if (opts.connectionTimeout != 0)
560 opts.client.setTimeout(opts.connectionTimeout * 1000);
563 // Save the total connect time.
564 double totalConnectTime = opts.elapsedTime.getElapsed();
566 // Setup the other timers.
567 double totalTime = 0;
568 Uint32 repeatCount = opts.repeat;
570 double minTime = 10000000;
572 Uint64 serverTotalTime = 0;
573 Uint64 maxServerTime = 0;
574 Uint64 minServerTime = 10000000;
576 Uint64 rtTotalTime = 0;
577 Uint64 maxRtTime = 0;
578 Uint64 minRtTime = 10000000;
581 // Process the requestd operation action function
582 // Process the function within a try block to catch all operation
583 // command exceptions
587 // Loop to repeat the command a number of times.
588 // while opts.repeat > 0
591 // or exit with error through default of case logic
592 switch(thisOperation.get().ID_Operation)
594 case ID_EnumerateInstanceNames :
595 if (!_getClassNameInput(argc, argv, opts, true))
597 exit(CIMCLI_INPUT_ERR);
599 opts.termCondition = enumerateInstanceNames(opts);
602 case ID_EnumerateAllInstanceNames :
603 if (!_getClassNameInput(argc, argv, opts, false))
605 exit(CIMCLI_INPUT_ERR);
607 opts.termCondition = enumerateAllInstanceNames(opts);
610 case ID_EnumerateInstances :
611 if (!_getClassNameInput(argc, argv, opts, true))
613 exit(CIMCLI_INPUT_ERR);
615 opts.termCondition = enumerateInstances(opts);
617 case ID_GetInstance :
618 if (!_getObjectNameInput(argc, argv, opts, true))
620 exit(CIMCLI_INPUT_ERR);
622 opts.termCondition = getInstance(opts);
625 case ID_EnumerateClassNames :
626 if (!_getClassNameInput(argc, argv, opts, false))
628 exit(CIMCLI_INPUT_ERR);
630 opts.termCondition = enumerateClassNames(opts);
633 case ID_EnumerateClasses :
634 if (!_getClassNameInput(argc, argv, opts, false))
636 exit(CIMCLI_INPUT_ERR);
638 opts.termCondition = enumerateClasses(opts);
642 if (!_getClassNameInput(argc, argv, opts, true))
644 exit(CIMCLI_INPUT_ERR);
646 opts.termCondition = getClass(opts);
649 case ID_CreateInstance :
650 if (!_getClassNameInput(argc, argv, opts, true))
652 exit(CIMCLI_INPUT_ERR);
654 opts.termCondition = createInstance(opts);
657 case ID_TestInstance :
658 if (!_getObjectNameInput(argc, argv, opts, true))
660 exit(CIMCLI_INPUT_ERR);
662 opts.termCondition = testInstance(opts);
665 case ID_ModifyInstance :
666 if (!_getObjectNameInput(argc, argv, opts, true))
668 exit(CIMCLI_INPUT_ERR);
670 opts.termCondition = modifyInstance(opts);
673 case ID_DeleteInstance :
674 if (!_getObjectNameInput(argc, argv, opts, true))
676 exit(CIMCLI_INPUT_ERR);
678 opts.termCondition = deleteInstance(opts);
681 case ID_CreateClass :
682 cerr << "CreateClass not implemented" << endl;
683 exit(CIMCLI_INPUT_ERR);
686 case ID_DeleteClass :
687 if (!_getClassNameInput(argc, argv, opts, true))
689 exit(CIMCLI_INPUT_ERR);
691 opts.termCondition = deleteClass(opts);
694 case ID_GetProperty :
697 cout << "Usage: cli getproperty <instancename>"
699 " cli getproperty <classname>"
700 " <propertyname> <keypropert=value>*" << endl;
701 exit(CIMCLI_INPUT_ERR);
704 if (!_getObjectNameInput(argc, argv, opts, true))
706 exit(CIMCLI_INPUT_ERR);
709 opts.propertyName = argv[3];
710 opts.valueParams.remove(0);
712 opts.termCondition = getProperty(opts);
715 case ID_SetProperty :
719 "Usage: cli setproperty instancename propertyname"
726 case ID_EnumerateQualifiers :
727 opts.termCondition = enumerateQualifiers(opts);
730 case ID_SetQualifier :
731 cerr << "SetQualifer not implemented" << endl;
732 exit(CIMCLI_INPUT_ERR);
735 case ID_GetQualifier :
736 if (!_getQualifierNameInput(argc, argv, opts))
738 exit(CIMCLI_INPUT_ERR);
740 opts.termCondition = getQualifier(opts);
743 case ID_DeleteQualifier :
744 if (!_getQualifierNameInput(argc, argv, opts))
746 exit(CIMCLI_INPUT_ERR);
748 opts.termCondition = deleteQualifier(opts);
752 if (!_getObjectNameInput(argc, argv, opts, true))
754 exit(CIMCLI_INPUT_ERR);
756 opts.termCondition = references(opts);
759 case ID_ReferenceNames :
760 if (!_getObjectNameInput(argc, argv, opts, true))
762 exit(CIMCLI_INPUT_ERR);
764 opts.termCondition = referenceNames(opts);
767 case ID_Associators :
768 if (!_getObjectNameInput(argc, argv, opts, true))
770 exit(CIMCLI_INPUT_ERR);
772 opts.termCondition = associators(opts);
775 case ID_AssociatorNames :
776 if (!_getObjectNameInput(argc, argv, opts, true))
778 exit(CIMCLI_INPUT_ERR);
780 opts.termCondition = associatorNames(opts);
783 case ID_EnumerateNamespaces :
784 // Note that the following constants are fixed here. We
785 // should be getting them from the environment to assure
786 // that others know that we are using them.
787 //opts.className = PEGASUS_CLASSNAME_CIMNAMESPACE;
791 opts.nameSpace = argv[2];
792 opts.inputObjectName = argv[2];
796 // set nameSpace to interop namespace name
798 PEGASUS_NAMESPACENAME_INTEROP.getString();
801 opts.termCondition = enumerateNamespaceNames(opts);
804 case ID_InvokeMethod :
807 cerr << "Usage: InvokeMethod requires that object and"
808 " method names be specified.\n"
809 "Input parameters are optional and can be"
810 " specified as additional parameters to"
812 "Enter each input parameter as name=value"
813 " (no spaces around equal sign)."
815 exit(CIMCLI_INPUT_ERR);
818 if (!_getObjectNameInput(argc, argv, opts, true))
820 exit(CIMCLI_INPUT_ERR);
823 opts.methodName = CIMName(argv[3]);
824 // remove the method name argument
825 opts.valueParams.remove(0);
827 // If there are any extra arguments they must be parameters
828 // These parameters can be used in addtion to parameters
829 // ifrom the -ip option setting. Parameters found here must
830 // be key=value pairs or they will generate an exception.
832 opts.termCondition = invokeMethod(opts);
835 case ID_ShowOptions :
840 if (argc <= 2 && opts.query.size() == 0)
842 cerr << "ERROR: ExecQuery requires a query"
843 "filter definition\n"
844 " - supplied directly as a parameter\n"
845 " - OR supplied with the -f option\n"
846 " The filterLanguage may be supplied\n"
847 " - as the second argument\n"
848 " - OR as the -ql option\n"
851 opts.query = argv[2];
854 opts.queryLanguage = argv[3];
856 opts.termCondition = execQuery(opts);
859 case ID_StatisticsOn:
861 setObjectManagerStatistics(opts, true, rtndState);
864 case ID_StatisticsOff:
865 opts.termCondition = setObjectManagerStatistics(
866 opts, false, rtndState);
870 cout << "Invalid cimcli operation name. "
871 "Operation name must be first parmeter"
873 << " \n ex. cli enumerateclasses\n"
874 << "Enter " << argv[0] << " -h for help."
876 exit(CIMCLI_INPUT_ERR);
878 } // switch statement
880 // If the repeat option set, do any interim time calculation
881 // and output and decrement the repeat count
884 if (opts.verboseTest)
886 cout << "Repetitition " << opts.repeat << endl;
892 totalTime += opts.saveElapsedTime;
893 maxTime = LOCAL_MAX(maxTime, opts.saveElapsedTime);
894 minTime = LOCAL_MIN(minTime, opts.saveElapsedTime);
895 rtTotalTime += (returnedPerformanceData.roundTripTime);
896 maxRtTime = LOCAL_MAX(maxRtTime,
897 returnedPerformanceData.roundTripTime);
898 minRtTime = LOCAL_MIN(minRtTime,
899 returnedPerformanceData.roundTripTime);
901 if (returnedPerformanceData.serverTimeKnown)
903 serverTotalTime += (returnedPerformanceData.serverTime);
904 maxServerTime = LOCAL_MAX(maxServerTime,
905 returnedPerformanceData.serverTime);
906 minServerTime = LOCAL_MIN(minServerTime,
907 returnedPerformanceData.serverTime);
911 } while (opts.repeat > 0 );
913 // Command processing complete. If the time parameter is set,
914 // output any total time information
918 cout << thisOperation.get().OperationName << " "
919 << opts.inputObjectName;
921 if (repeatCount == 0)
924 << opts.saveElapsedTime
927 << CIMValue(returnedPerformanceData.serverTime).toString()
930 << CIMValue(returnedPerformanceData.roundTripTime).
934 << CIMValue(returnedPerformanceData.requestSize).toString()
936 << CIMValue(returnedPerformanceData.responseSize).toString()
942 cout << " Total Time "
947 << (totalTime * 1000000)/repeatCount
951 << (maxTime * 1000000)
952 << " us SvrTime avg= "
953 << CIMValue(serverTotalTime/repeatCount).toString()
954 << " us SvrTime min= "
955 << CIMValue(minServerTime).toString()
956 << " us SvrTime max= "
957 << CIMValue(maxServerTime).toString()
960 << CIMValue(rtTotalTime/repeatCount).toString()
961 << " us RtTime min= "
962 << CIMValue(minRtTime).toString()
963 << " us RtTime max= "
964 << CIMValue(maxRtTime).toString()
971 // Exceptions for action operations try block
972 // The following exceptions are all routed to cerr
973 catch(CIMException& e)
975 cerr << argv[0] << " CIMException: "
976 <<" Cmd= " << opts.cimCmd
977 << " Object= " << opts.inputObjectName
978 << " Code= " << e.getCode()
979 << "\n" << e.getMessage()
981 opts.termCondition = e.getCode();
985 cerr << argv[0] << " Pegasus Exception: " << e.getMessage()
986 << ". Cmd = " << opts.cimCmd
987 << " Object = " << opts.inputObjectName
989 opts.termCondition = CIMCLI_RTN_CODE_PEGASUS_EXCEPTION;
993 cerr << argv[0] << " Caught General Exception:" << endl;
994 opts.termCondition = CIMCLI_RTN_CODE_UNKNOWN_EXCEPTION;
997 totalElapsedExecutionTime.stop();
1001 // if abnormal term, dump all times
1002 if (opts.termCondition != 0)
1004 cout << "Exception" << endl;
1005 cout << "Prev Time " << opts.saveElapsedTime << " Sec" << endl;
1006 opts.saveElapsedTime = opts.elapsedTime.getElapsed();
1007 cout << "Last Time " << opts.saveElapsedTime << " Sec" << endl;
1008 cout << "Total Time " << totalTime << " for "
1009 << repeatCount << " operations. Avg.= "
1010 << totalTime/repeatCount
1011 << " min= " << minTime << " max= " << maxTime << endl;
1014 cout << "Total Elapsed Time= "
1015 << totalElapsedExecutionTime.getElapsed()
1016 << " Sec. Terminated at " << System::getCurrentASCIITime()
1020 // if delay parameter set, sleep before terminating.
1021 if (opts.delay != 0)
1023 Threads::sleep(opts.delay * 1000);
1026 // Terminate with termination code
1028 exit(opts.termCondition);
1031 //PEGASUS_NAMESPACE_END