Summary
This article shows how to extract a list of procedures from your installed plugin library. The approach applies to extracting data from other XML-generating API commands.
Solution
Use the Perl XPATH methods find() and get_nodelist on API get commands to generate list that can be processed with a for-loop.
Examples
use strict; use ElectricCommander; $| = 1; my $ec = ElectricCommander->new(); for my $plugin ($ec->getPlugins()->find('//pluginName')->get_nodelist) { print "Plugin: ", $plugin->string_value(), "\n"; for my $procedure ($ec->getProcedures($plugin->string_value())->find('//procedureName')->get_nodelist) { print " - ", $procedure->string_value(), "\n"; } print "\n"; }
The above ec-perl code will generate output similar to the following:
- CleanUp - Clone - Create - CreateResourceFromVM - Destroy - List - Resume - Revert - ShutDown - Snapshot - Start - Suspend - Undefine Plugin: EC-LabManager-1.5.0.43267 - BulkCleanup - Capture - Cleanup - Clone - Command - ConfigurationChangeOwner - CreateConfigurationFromVMTemplate - CreateConfigurationFromVMTemplate4.0 - CreateLMConnection - CreateResourcesFromConfiguration - DeleteLMConnection - Deploy - Provision - Provision4.0 - Revert - Snapshot
This article is part of our Knowledge Base and is provided for guidance-based purposes only. The solutions or workarounds described here are not officially supported by CloudBees and may not be applicable in all environments. Use at your own discretion, and test changes in a safe environment before applying them to production systems.