summaryrefslogtreecommitdiffstats
path: root/config-db/slxconfig
diff options
context:
space:
mode:
authorOliver Tappe2007-07-18 20:51:43 +0200
committerOliver Tappe2007-07-18 20:51:43 +0200
commitce96f4e21ef9d3081decd3e7bc9be41827c2dd4c (patch)
tree4276290e8b68bd74cafce6189bf2ef0c62d78642 /config-db/slxconfig
parent* some cleanup - we now make use of here-docs where feasible (diff)
downloadcore-ce96f4e21ef9d3081decd3e7bc9be41827c2dd4c.tar.gz
core-ce96f4e21ef9d3081decd3e7bc9be41827c2dd4c.tar.xz
core-ce96f4e21ef9d3081decd3e7bc9be41827c2dd4c.zip
* fixed use of an uninitialized value
* added support for automatically dropping 'name=""' constructs whenever only the name is expected (as a special gift to Dirk ;-P) git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1253 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'config-db/slxconfig')
-rwxr-xr-xconfig-db/slxconfig35
1 files changed, 24 insertions, 11 deletions
diff --git a/config-db/slxconfig b/config-db/slxconfig
index 50c8d8cd..88eb2769 100755
--- a/config-db/slxconfig
+++ b/config-db/slxconfig
@@ -178,7 +178,7 @@ sub dumpElements
sub listClients
{
- my $name = shift;
+ my $name = _cleanName(shift);
my %nameSpec;
# set verbose mode if any params have been passed in:
@@ -206,7 +206,7 @@ sub listClients
sub listExports
{
- my $name = shift;
+ my $name = _cleanName(shift);
my %nameSpec;
# set verbose mode if any params have been passed in:
@@ -236,7 +236,7 @@ sub listExports
sub listSystems
{
- my $name = shift;
+ my $name = _cleanName(shift);
my %nameSpec;
# set verbose mode if any params have been passed in:
@@ -268,7 +268,7 @@ sub listSystems
sub listVendorOSes
{
- my $name = shift;
+ my $name = _cleanName(shift);
my %nameSpec;
# set verbose mode if any params have been passed in:
@@ -390,7 +390,7 @@ sub searchVendorOSes
sub addClientToConfigDB
{
- my $clientName = shift;
+ my $clientName = _cleanName(shift || '');
if (!length($clientName)) {
die _tr("you have to specify the name for the new client\n");
@@ -418,7 +418,7 @@ sub addClientToConfigDB
delete $clientData->{systems};
}
- if (!length($clientData->{mac})) {
+ if (!$clientData->{mac}) {
die _tr("you have to specify the MAC for the new client\n");
}
if ($clientData->{mac} !~ m[^(?:[[:xdigit:]][[:xdigit:]]:){5}?[[:xdigit:]][[:xdigit:]]$]) {
@@ -447,7 +447,7 @@ sub addClientToConfigDB
sub addSystemToConfigDB
{
- my $systemName = shift;
+ my $systemName = _cleanName(shift || '');
if (!length($systemName)) {
die _tr("you have to specify the name of the new system!\n");
@@ -534,7 +534,7 @@ sub addSystemToConfigDB
sub changeClientInConfigDB
{
- my $clientName = shift;
+ my $clientName = _cleanName(shift || '');
if (!length($clientName)) {
die _tr("you have to specify the name for the client you'd like to change!\n");
@@ -611,7 +611,7 @@ sub changeClientInConfigDB
sub changeSystemInConfigDB
{
- my $systemName = shift;
+ my $systemName = _cleanName(shift || '');
if (!length($systemName)) {
die _tr("you have to specify the name of the system you'd like to change!\n");
@@ -682,7 +682,7 @@ sub changeSystemInConfigDB
sub removeClientFromConfigDB
{
- my $clientName = shift;
+ my $clientName = _cleanName(shift || '');
if (!length($clientName)) {
die _tr("you have to specify the name of the client you'd like to remove!\n");
@@ -706,7 +706,7 @@ sub removeClientFromConfigDB
sub removeSystemFromConfigDB
{
- my $systemName = shift;
+ my $systemName = _cleanName(shift || '');
if (!length($systemName)) {
die _tr("you have to specify the name of the system you'd like to remove!\n");
@@ -728,6 +728,19 @@ sub removeSystemFromConfigDB
return;
}
+sub _cleanName
+{ # removes 'name=""' constructs from the name, as it is rather tempting
+ # for the user to type that ... (and we'd like to play along with DWIM)
+ my $name = shift;
+
+ return unless defined $name;
+
+ if ($name =~ m[^name=(.+)$]) {
+ return $1;
+ }
+ return $name;
+}
+
=head1 NAME
slxconfig - OpenSLX-script to view & change the configurational database