summaryrefslogtreecommitdiffstats
path: root/os-plugins/slxos-plugin
diff options
context:
space:
mode:
authorOliver Tappe2008-02-17 16:55:22 +0100
committerOliver Tappe2008-02-17 16:55:22 +0100
commit60bee60e6acbe08dfce92a9160a77860c00856ab (patch)
treeba037faaa8632690a5931edca1f8cc583194af3a /os-plugins/slxos-plugin
parent* correct implementation bug that caused last schema change to work only half... (diff)
downloadcore-60bee60e6acbe08dfce92a9160a77860c00856ab.tar.gz
core-60bee60e6acbe08dfce92a9160a77860c00856ab.tar.xz
core-60bee60e6acbe08dfce92a9160a77860c00856ab.zip
* added support to listing the plugins that have been installed into a
specific vendor-OS * several small fixes and improvements git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1558 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'os-plugins/slxos-plugin')
-rwxr-xr-xos-plugins/slxos-plugin56
1 files changed, 47 insertions, 9 deletions
diff --git a/os-plugins/slxos-plugin b/os-plugins/slxos-plugin
index ba407994..8400ecf7 100755
--- a/os-plugins/slxos-plugin
+++ b/os-plugins/slxos-plugin
@@ -59,8 +59,9 @@ openslxInit();
my $action = shift @ARGV || '';
-if ($action =~ m[^list]i) {
- my @pluginFolders = glob("$openslxConfig{'base-path'}/lib/plugins/*");
+if ($action =~ m[^list-a]i) {
+ my @pluginFolders
+ = grep { -d $_ } glob("$openslxConfig{'base-path'}/lib/plugins/*");
print _tr("List of available plugins:\n");
require OpenSLX::OSPlugin::Roster;
my $pluginInfo = OpenSLX::OSPlugin::Roster->getAvailablePlugins();
@@ -84,10 +85,34 @@ if ($action =~ m[^list]i) {
}
sort keys %$pluginInfo
);
+} elsif ($action =~ m[^list-i]i) {
+ if (scalar(@ARGV) != 1) {
+ print STDERR _tr(
+ "You need to specify exactly one vendor-OS!\n"
+ );
+ pod2usage(2);
+ }
+ my $vendorOSName = shift @ARGV;
+
+ # we chdir into the script's folder such that all relative paths have
+ # a known starting point:
+ chdir($FindBin::RealBin)
+ or die _tr("can't chdir to script-path <%> (%s)", $FindBin::RealBin, $!);
+
+ # create OSPlugin-engine for given vendor-OS and ask it for the installed
+ # plugins:
+ my $engine = OpenSLX::OSPlugin::Engine->new;
+ $engine->initialize(undef, $vendorOSName);
+ my @installedPlugins = $engine->getInstalledPlugins();
+ if (!@installedPlugins) {
+ push @installedPlugins, '<none>';
+ }
+ print _tr("List of plugins installed in vendor-OS '$vendorOSName':\n");
+ print join('', map { "\t$_\n" } sort @installedPlugins);
} elsif ($action =~ m[^install]i) {
if (scalar(@ARGV) != 2) {
print STDERR _tr(
- "You need to specify exactly one plugin-name and one vendor-os!\n"
+ "You need to specify exactly one plugin-name and one vendor-OS!\n"
);
pod2usage(2);
}
@@ -106,15 +131,19 @@ if ($action =~ m[^list]i) {
die _tr("plugin '%s' doesn't exist, giving up!\n",
$engine->{'plugin-path'});
}
- if (!-e $engine->{'vendor-os-path'}) {
+ if ($vendorOSName ne '<<<default>>>' && !-e $engine->{'vendor-os-path'}) {
die _tr("vendor-OS '%s' doesn't exist, giving up!\n",
$engine->{'vendor-os-path'});
}
- $engine->installPlugin();
+ if ($engine->installPlugin()) {
+ print _tr(
+ "Plugin $pluginName has been installed into vendor-OS '$vendorOSName'.\n"
+ );
+ }
} elsif ($action =~ m[^remove]i) {
if (scalar(@ARGV) != 2) {
print STDERR _tr(
- "You need to specify exactly one plugin-name and one vendor-os!\n"
+ "You need to specify exactly one plugin-name and one vendor-OS!\n"
);
pod2usage(2);
}
@@ -133,16 +162,21 @@ if ($action =~ m[^list]i) {
die _tr("plugin '%s' doesn't exist, giving up!\n",
$engine->{'plugin-path'});
}
- if (!-e $engine->{'vendor-os-path'}) {
+ if ($vendorOSName ne '<<<default>>>' && !-e $engine->{'vendor-os-path'}) {
die _tr("vendor-OS '%s' doesn't exist, giving up!\n",
$engine->{'vendor-os-path'});
}
- $engine->removePlugin();
+ if ($engine->removePlugin()) {
+ print _tr(
+ "Plugin $pluginName has been removed from vendor-OS '$vendorOSName'.\n"
+ );
+ }
} else {
vlog(0, _tr(unshiftHereDoc(<<' END-OF-HERE'), $0));
You need to specify exactly one action:
- list-available
install <plugin-name> <vendor-OS-name>
+ list-available
+ list-installed
remove <plugin-name> <vendor-OS-name>
Try '%s --help' for more info.
END-OF-HERE
@@ -176,6 +210,10 @@ installs the OS-plugin with the given name into the specified vendor-OS
list all available OS-plugins
+=item B<< list-installed <vendor-os-name> >>
+
+list all the plugins installed into the specified vendor-OS
+
=item B<< remove <plugin-name> <vendor-OS-name> >>
removes the OS-plugin with the given name from the specified vendor-OS