summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config-db/OpenSLX/AttrInfo/Core.pm353
-rw-r--r--config-db/OpenSLX/AttributeRoster.pm375
-rw-r--r--config-db/OpenSLX/ConfigDB.pm2
-rw-r--r--config-db/OpenSLX/DBSchema.pm172
-rw-r--r--os-plugins/OpenSLX/OSPlugin/Base.pm130
-rw-r--r--os-plugins/OpenSLX/OSPlugin/Engine.pm52
-rw-r--r--os-plugins/OpenSLX/OSPlugin/Roster.pm56
-rw-r--r--os-plugins/plugins/Example/OpenSLX/OSPlugin/Example.pm111
-rw-r--r--os-plugins/plugins/VMware/OpenSLX/OSPlugin/VMware.pm87
9 files changed, 726 insertions, 612 deletions
diff --git a/config-db/OpenSLX/AttrInfo/Core.pm b/config-db/OpenSLX/AttrInfo/Core.pm
deleted file mode 100644
index 9716fb34..00000000
--- a/config-db/OpenSLX/AttrInfo/Core.pm
+++ /dev/null
@@ -1,353 +0,0 @@
-# Copyright (c) 2006, 2007 - OpenSLX GmbH
-#
-# This program is free software distributed under the GPL version 2.
-# See http://openslx.org/COPYING
-#
-# If you have any feedback please consult http://openslx.org/feedback and
-# send your suggestions, praise, or complaints to feedback@openslx.org
-#
-# General information about OpenSLX can be found at http://openslx.org/
-# -----------------------------------------------------------------------------
-# AttrInfo::Core
-# - provides info about the core attributes.
-# -----------------------------------------------------------------------------
-package OpenSLX::AttrInfo::Core;
-
-use strict;
-use warnings;
-
-use OpenSLX::Utils;
-
-sub new
-{
- my $class = shift;
-
- my $self = {
- };
-
- return bless $self, $class;
-}
-
-sub AttrInfo
-{
- return {
- 'automnt_dir' => {
- applies_to_systems => 1,
- applies_to_clients => 1,
- description => unshiftHereDoc(<<' End-of-Here'),
- !!!descriptive text missing here!!!
- End-of-Here
- content_regex => undef,
- content_descr => undef,
- },
- 'automnt_src' => {
- applies_to_systems => 1,
- applies_to_clients => 1,
- description => unshiftHereDoc(<<' End-of-Here'),
- !!!descriptive text missing here!!!
- End-of-Here
- content_regex => undef,
- content_descr => undef,
- },
- 'country' => {
- applies_to_systems => 1,
- applies_to_clients => 1,
- description => unshiftHereDoc(<<' End-of-Here'),
- !!!descriptive text missing here!!!
- End-of-Here
- content_regex => undef,
- content_descr => undef,
- },
- 'dm_allow_shutdown' => {
- applies_to_systems => 1,
- applies_to_clients => 1,
- description => unshiftHereDoc(<<' End-of-Here'),
- !!!descriptive text missing here!!!
- End-of-Here
- content_regex => undef,
- content_descr => undef,
- },
- 'hw_graphic' => {
- applies_to_systems => 1,
- applies_to_clients => 1,
- description => unshiftHereDoc(<<' End-of-Here'),
- !!!descriptive text missing here!!!
- End-of-Here
- content_regex => undef,
- content_descr => undef,
- },
- 'hw_monitor' => {
- applies_to_systems => 1,
- applies_to_clients => 1,
- description => unshiftHereDoc(<<' End-of-Here'),
- !!!descriptive text missing here!!!
- End-of-Here
- content_regex => undef,
- content_descr => undef,
- },
- 'hw_mouse' => {
- applies_to_systems => 1,
- applies_to_clients => 1,
- description => unshiftHereDoc(<<' End-of-Here'),
- !!!descriptive text missing here!!!
- End-of-Here
- content_regex => undef,
- content_descr => undef,
- },
- 'late_dm' => {
- applies_to_systems => 1,
- applies_to_clients => 1,
- description => unshiftHereDoc(<<' End-of-Here'),
- !!!descriptive text missing here!!!
- End-of-Here
- content_regex => undef,
- content_descr => undef,
- },
- 'netbios_workgroup' => {
- applies_to_systems => 1,
- applies_to_clients => 1,
- description => unshiftHereDoc(<<' End-of-Here'),
- !!!descriptive text missing here!!!
- End-of-Here
- content_regex => undef,
- content_descr => undef,
- },
- 'nis_domain' => {
- applies_to_systems => 1,
- applies_to_clients => 1,
- description => unshiftHereDoc(<<' End-of-Here'),
- !!!descriptive text missing here!!!
- End-of-Here
- content_regex => undef,
- content_descr => undef,
- },
- 'nis_servers' => {
- applies_to_systems => 1,
- applies_to_clients => 1,
- description => unshiftHereDoc(<<' End-of-Here'),
- !!!descriptive text missing here!!!
- End-of-Here
- content_regex => undef,
- content_descr => undef,
- },
- 'sane_scanner' => {
- applies_to_systems => 1,
- applies_to_clients => 1,
- description => unshiftHereDoc(<<' End-of-Here'),
- !!!descriptive text missing here!!!
- End-of-Here
- content_regex => undef,
- content_descr => undef,
- },
- 'scratch' => {
- applies_to_systems => 1,
- applies_to_clients => 1,
- description => unshiftHereDoc(<<' End-of-Here'),
- !!!descriptive text missing here!!!
- End-of-Here
- content_regex => undef,
- content_descr => undef,
- },
- 'slxgrp' => {
- applies_to_systems => 1,
- applies_to_clients => 1,
- description => unshiftHereDoc(<<' End-of-Here'),
- !!!descriptive text missing here!!!
- End-of-Here
- content_regex => undef,
- content_descr => undef,
- },
- 'start_alsasound' => {
- applies_to_systems => 1,
- applies_to_clients => 1,
- description => unshiftHereDoc(<<' End-of-Here'),
- !!!descriptive text missing here!!!
- End-of-Here
- content_regex => undef,
- content_descr => undef,
- },
- 'start_atd' => {
- applies_to_systems => 1,
- applies_to_clients => 1,
- description => unshiftHereDoc(<<' End-of-Here'),
- !!!descriptive text missing here!!!
- End-of-Here
- content_regex => undef,
- content_descr => undef,
- },
- 'start_cron' => {
- applies_to_systems => 1,
- applies_to_clients => 1,
- description => unshiftHereDoc(<<' End-of-Here'),
- !!!descriptive text missing here!!!
- End-of-Here
- content_regex => undef,
- content_descr => undef,
- },
- 'start_dreshal' => {
- applies_to_systems => 1,
- applies_to_clients => 1,
- description => unshiftHereDoc(<<' End-of-Here'),
- !!!descriptive text missing here!!!
- End-of-Here
- content_regex => undef,
- content_descr => undef,
- },
- 'start_ntp' => {
- applies_to_systems => 1,
- applies_to_clients => 1,
- description => unshiftHereDoc(<<' End-of-Here'),
- !!!descriptive text missing here!!!
- End-of-Here
- content_regex => undef,
- content_descr => undef,
- },
- 'start_nfsv4' => {
- applies_to_systems => 1,
- applies_to_clients => 1,
- description => unshiftHereDoc(<<' End-of-Here'),
- !!!descriptive text missing here!!!
- End-of-Here
- content_regex => undef,
- content_descr => undef,
- },
- 'start_printer' => {
- applies_to_systems => 1,
- applies_to_clients => 1,
- description => unshiftHereDoc(<<' End-of-Here'),
- !!!descriptive text missing here!!!
- End-of-Here
- content_regex => undef,
- content_descr => undef,
- },
- 'start_samba' => {
- applies_to_systems => 1,
- applies_to_clients => 1,
- description => unshiftHereDoc(<<' End-of-Here'),
- !!!descriptive text missing here!!!
- End-of-Here
- content_regex => undef,
- content_descr => undef,
- },
- 'start_snmp' => {
- applies_to_systems => 1,
- applies_to_clients => 1,
- description => unshiftHereDoc(<<' End-of-Here'),
- !!!descriptive text missing here!!!
- End-of-Here
- content_regex => undef,
- content_descr => undef,
- },
- 'start_sshd' => {
- applies_to_systems => 1,
- applies_to_clients => 1,
- description => unshiftHereDoc(<<' End-of-Here'),
- !!!descriptive text missing here!!!
- End-of-Here
- content_regex => undef,
- content_descr => undef,
- },
- 'start_syslogd' => {
- applies_to_systems => 1,
- applies_to_clients => 1,
- description => unshiftHereDoc(<<' End-of-Here'),
- !!!descriptive text missing here!!!
- End-of-Here
- content_regex => undef,
- content_descr => undef,
- },
- 'start_x' => {
- applies_to_systems => 1,
- applies_to_clients => 1,
- description => unshiftHereDoc(<<' End-of-Here'),
- !!!descriptive text missing here!!!
- End-of-Here
- content_regex => undef,
- content_descr => undef,
- },
- 'start_xdmcp' => {
- applies_to_systems => 1,
- applies_to_clients => 1,
- description => unshiftHereDoc(<<' End-of-Here'),
- !!!descriptive text missing here!!!
- End-of-Here
- content_regex => undef,
- content_descr => undef,
- },
- 'tex_enable' => {
- applies_to_systems => 1,
- applies_to_clients => 1,
- description => unshiftHereDoc(<<' End-of-Here'),
- !!!descriptive text missing here!!!
- End-of-Here
- content_regex => undef,
- content_descr => undef,
- },
- 'timezone' => {
- applies_to_systems => 1,
- applies_to_clients => 1,
- description => unshiftHereDoc(<<' End-of-Here'),
- textual timezone (e.g. 'Europe/Berlin')
- End-of-Here
- content_regex => undef,
- content_descr => undef,
- },
- 'tvout' => {
- applies_to_systems => 1,
- applies_to_clients => 1,
- description => unshiftHereDoc(<<' End-of-Here'),
- !!!descriptive text missing here!!!
- End-of-Here
- content_regex => undef,
- content_descr => undef,
- },
- 'vmware' => {
- applies_to_systems => 1,
- applies_to_clients => 1,
- description => unshiftHereDoc(<<' End-of-Here'),
- !!!descriptive text missing here!!!
- End-of-Here
- content_regex => undef,
- content_descr => undef,
- },
-
- 'ramfs_fsmods' => {
- applies_to_systems => 1,
- applies_to_clients => 0,
- description => unshiftHereDoc(<<' End-of-Here'),
- list of filesystem kernel modules to load
- End-of-Here
- content_regex => undef,
- content_descr => undef,
- },
- 'ramfs_miscmods' => {
- applies_to_systems => 1,
- applies_to_clients => 0,
- description => unshiftHereDoc(<<' End-of-Here'),
- list of miscellaneous kernel modules to load
- End-of-Here
- content_regex => undef,
- content_descr => undef,
- },
- 'ramfs_nicmods' => {
- applies_to_systems => 1,
- applies_to_clients => 0,
- description => unshiftHereDoc(<<' End-of-Here'),
- list of network card modules to load
- End-of-Here
- content_regex => undef,
- content_descr => undef,
- },
- 'ramfs_screen' => {
- applies_to_systems => 1,
- applies_to_clients => 0,
- description => unshiftHereDoc(<<' End-of-Here'),
- resolution of splash screen to use in stage3
- End-of-Here
- content_regex => undef,
- content_descr => undef,
- },
- };
-}
-
-1;
diff --git a/config-db/OpenSLX/AttributeRoster.pm b/config-db/OpenSLX/AttributeRoster.pm
index 481aeb3b..06dc95db 100644
--- a/config-db/OpenSLX/AttributeRoster.pm
+++ b/config-db/OpenSLX/AttributeRoster.pm
@@ -16,38 +16,363 @@ package OpenSLX::AttributeRoster;
use strict;
use warnings;
-our (@ISA, @EXPORT, $VERSION);
-
-use Exporter;
-$VERSION = 1.01;
-@ISA = qw(Exporter);
-
-@EXPORT = qw(
- $%AttributeInfo
-);
-
use OpenSLX::Basics;
+use OpenSLX::OSPlugin::Roster;
+use OpenSLX::Utils;
################################################################################
###
-### Load the available AttrInfo-modules and build a hash containing info about
-### all known attributes from the data contained in those modules.
+### Integrate info about all known attributes (from core and from the plugins)
+### into one big hash.
###
################################################################################
-my %AttributeInfo = ();
-
-my $libPath = "$openslxConfig{'base-path'}/lib";
-foreach my $module (glob("$libPath/OpenSLX/AttrInfo/*.pm")) {
- next if $module !~ m{/([^/]+)\.pm$};
- my $class = "OpenSLX::AttrInfo::$1";
- vlog(2, "loading attr-info from module '$module'");
- my $instance = instantiateClass($class);
- my $attrInfo = $instance->AttrInfo();
- foreach my $attr (keys %$attrInfo) {
- $AttributeInfo{$attr} = $attrInfo->{$attr};
- }
-}
+# set core attributes
+my %AttributeInfo = (
+ 'automnt_dir' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ !!!descriptive text missing here!!!
+ End-of-Here
+ content_regex => undef,
+ content_descr => undef,
+ default => '',
+ },
+ 'automnt_src' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ !!!descriptive text missing here!!!
+ End-of-Here
+ content_regex => undef,
+ content_descr => undef,
+ default => '',
+ },
+ 'country' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ !!!descriptive text missing here!!!
+ End-of-Here
+ content_regex => undef,
+ content_descr => undef,
+ default => 'de',
+ },
+ 'dm_allow_shutdown' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ !!!descriptive text missing here!!!
+ End-of-Here
+ content_regex => undef,
+ content_descr => undef,
+ default => 'user',
+ },
+ 'hw_graphic' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ !!!descriptive text missing here!!!
+ End-of-Here
+ content_regex => undef,
+ content_descr => undef,
+ default => '',
+ },
+ 'hw_monitor' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ !!!descriptive text missing here!!!
+ End-of-Here
+ content_regex => undef,
+ content_descr => undef,
+ default => '',
+ },
+ 'hw_mouse' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ !!!descriptive text missing here!!!
+ End-of-Here
+ content_regex => undef,
+ content_descr => undef,
+ default => '',
+ },
+ 'netbios_workgroup' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ !!!descriptive text missing here!!!
+ End-of-Here
+ content_regex => undef,
+ content_descr => undef,
+ default => 'slx-network',
+ },
+ 'nis_domain' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ !!!descriptive text missing here!!!
+ End-of-Here
+ content_regex => undef,
+ content_descr => undef,
+ default => '',
+ },
+ 'nis_servers' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ !!!descriptive text missing here!!!
+ End-of-Here
+ content_regex => undef,
+ content_descr => undef,
+ default => '',
+ },
+ 'ramfs_fsmods' => {
+ applies_to_systems => 1,
+ applies_to_clients => 0,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ list of filesystem kernel modules to load
+ End-of-Here
+ content_regex => undef,
+ content_descr => undef,
+ default => '',
+ },
+ 'ramfs_miscmods' => {
+ applies_to_systems => 1,
+ applies_to_clients => 0,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ list of miscellaneous kernel modules to load
+ End-of-Here
+ content_regex => undef,
+ content_descr => undef,
+ default => '',
+ },
+ 'ramfs_nicmods' => {
+ applies_to_systems => 1,
+ applies_to_clients => 0,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ list of network card modules to load
+ End-of-Here
+ content_regex => undef,
+ content_descr => undef,
+ default => 'forcedeth e1000 e100 tg3 via-rhine r8169 pcnet32',
+ },
+ 'ramfs_screen' => {
+ applies_to_systems => 1,
+ applies_to_clients => 0,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ resolution of splash screen to use in stage3
+ End-of-Here
+ content_regex => undef,
+ content_descr => undef,
+ default => '',
+ },
+ 'sane_scanner' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ !!!descriptive text missing here!!!
+ End-of-Here
+ content_regex => undef,
+ content_descr => undef,
+ default => '',
+ },
+ 'scratch' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ !!!descriptive text missing here!!!
+ End-of-Here
+ content_regex => undef,
+ content_descr => undef,
+ default => '',
+ },
+ 'slxgrp' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ !!!descriptive text missing here!!!
+ End-of-Here
+ content_regex => undef,
+ content_descr => undef,
+ default => '',
+ },
+ 'start_alsasound' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ !!!descriptive text missing here!!!
+ End-of-Here
+ content_regex => undef,
+ content_descr => undef,
+ default => 'yes',
+ },
+ 'start_atd' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ !!!descriptive text missing here!!!
+ End-of-Here
+ content_regex => undef,
+ content_descr => undef,
+ default => 'no',
+ },
+ 'start_cron' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ !!!descriptive text missing here!!!
+ End-of-Here
+ content_regex => undef,
+ content_descr => undef,
+ default => 'no',
+ },
+ 'start_dreshal' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ !!!descriptive text missing here!!!
+ End-of-Here
+ content_regex => undef,
+ content_descr => undef,
+ default => 'yes',
+ },
+ 'start_ntp' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ !!!descriptive text missing here!!!
+ End-of-Here
+ content_regex => undef,
+ content_descr => undef,
+ default => 'initial',
+ },
+ 'start_nfsv4' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ !!!descriptive text missing here!!!
+ End-of-Here
+ content_regex => undef,
+ content_descr => undef,
+ default => 'no',
+ },
+ 'start_printer' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ !!!descriptive text missing here!!!
+ End-of-Here
+ content_regex => undef,
+ content_descr => undef,
+ default => 'no',
+ },
+ 'start_samba' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ !!!descriptive text missing here!!!
+ End-of-Here
+ content_regex => undef,
+ content_descr => undef,
+ default => 'may',
+ },
+ 'start_snmp' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ !!!descriptive text missing here!!!
+ End-of-Here
+ content_regex => undef,
+ content_descr => undef,
+ default => 'no',
+ },
+ 'start_sshd' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ !!!descriptive text missing here!!!
+ End-of-Here
+ content_regex => undef,
+ content_descr => undef,
+ default => 'yes',
+ },
+ 'start_syslogd' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ !!!descriptive text missing here!!!
+ End-of-Here
+ content_regex => undef,
+ content_descr => undef,
+ default => 'yes',
+ },
+ 'start_x' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ !!!descriptive text missing here!!!
+ End-of-Here
+ content_regex => undef,
+ content_descr => undef,
+ default => 'yes',
+ },
+ 'start_xdmcp' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ !!!descriptive text missing here!!!
+ End-of-Here
+ content_regex => undef,
+ content_descr => undef,
+ default => 'kdm',
+ },
+ 'tex_enable' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ !!!descriptive text missing here!!!
+ End-of-Here
+ content_regex => undef,
+ content_descr => undef,
+ default => 'no',
+ },
+ 'timezone' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ textual timezone (e.g. 'Europe/Berlin')
+ End-of-Here
+ content_regex => undef,
+ content_descr => undef,
+ default => 'Europe/Berlin',
+ },
+ 'tvout' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ !!!descriptive text missing here!!!
+ End-of-Here
+ content_regex => undef,
+ content_descr => undef,
+ default => 'no',
+ },
+ 'vmware' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ !!!descriptive text missing here!!!
+ End-of-Here
+ content_regex => undef,
+ content_descr => undef,
+ default => 'no',
+ },
+);
+
+# and add all plugin attributes, too
+OpenSLX::OSPlugin::Roster->addAllDefaultAttributesToHash(\%AttributeInfo);
=item C<getAttrInfo()>
diff --git a/config-db/OpenSLX/ConfigDB.pm b/config-db/OpenSLX/ConfigDB.pm
index f563619e..025af2f6 100644
--- a/config-db/OpenSLX/ConfigDB.pm
+++ b/config-db/OpenSLX/ConfigDB.pm
@@ -185,7 +185,7 @@ sub connect ## no critic (ProhibitBuiltinHomonyms)
$self->{'db-type'} = $dbType;
$self->{'meta-db'} = $metaDB;
- $self->{'db-schema'}->checkAndUpgradeDBSchemaIfNecessary($metaDB);
+ $self->{'db-schema'}->checkAndUpgradeDBSchemaIfNecessary($self);
return 1;
}
diff --git a/config-db/OpenSLX/DBSchema.pm b/config-db/OpenSLX/DBSchema.pm
index 7e8c0162..5bfc4122 100644
--- a/config-db/OpenSLX/DBSchema.pm
+++ b/config-db/OpenSLX/DBSchema.pm
@@ -16,6 +16,7 @@ package OpenSLX::DBSchema;
use strict;
use warnings;
+use OpenSLX::AttributeRoster;
use OpenSLX::Basics;
################################################################################
@@ -34,11 +35,7 @@ use OpenSLX::Basics;
### fk => foreign key (integer)
################################################################################
-use POSIX qw(locale_h);
-my $lang = setlocale(LC_MESSAGES);
-my $country = $lang =~ m[^\w\w_(\w\w)] ? lc($1) : 'us';
-
-my $VERSION = 0.21;
+my $VERSION = 0.22;
my $DbSchema = {
'version' => $VERSION,
@@ -211,120 +208,6 @@ my $DbSchema = {
'name:s.128', # attribute name
'value:s.255', # attribute value
],
- 'vals' => [
- # attributes of default system
- {
- 'system_id' => 0,
- 'name' => 'country',
- 'value' => "$country",
- },
- {
- 'system_id' => 0,
- 'name' => 'dm_allow_shutdown',
- 'value' => 'user',
- },
- {
- 'system_id' => 0,
- 'name' => 'late_dm',
- 'value' => 'no',
- },
- {
- 'system_id' => 0,
- 'name' => 'netbios_workgroup',
- 'value' => 'slx-network',
- },
- {
- 'system_id' => 0,
- 'name' => 'ramfs_nicmods',
- 'value'
- => 'forcedeth e1000 e100 tg3 via-rhine r8169 pcnet32',
- },
- {
- 'system_id' => 0,
- 'name' => 'start_alsasound',
- 'value' => 'yes',
- },
- {
- 'system_id' => 0,
- 'name' => 'start_atd',
- 'value' => 'no',
- },
- {
- 'system_id' => 0,
- 'name' => 'start_cron',
- 'value' => 'no',
- },
- {
- 'system_id' => 0,
- 'name' => 'start_dreshal',
- 'value' => 'yes',
- },
- {
- 'system_id' => 0,
- 'name' => 'start_ntp',
- 'value' => 'initial',
- },
- {
- 'system_id' => 0,
- 'name' => 'start_nfsv4',
- 'value' => 'no',
- },
- {
- 'system_id' => 0,
- 'name' => 'start_printer',
- 'value' => 'no',
- },
- {
- 'system_id' => 0,
- 'name' => 'start_samba',
- 'value' => 'may',
- },
- {
- 'system_id' => 0,
- 'name' => 'start_snmp',
- 'value' => 'no',
- },
- {
- 'system_id' => 0,
- 'name' => 'start_sshd',
- 'value' => 'yes',
- },
- {
- 'system_id' => 0,
- 'name' => 'start_syslog',
- 'value' => 'yes',
- },
- {
- 'system_id' => 0,
- 'name' => 'start_x',
- 'value' => 'yes',
- },
- {
- 'system_id' => 0,
- 'name' => 'start_xdmcp',
- 'value' => 'kdm',
- },
- {
- 'system_id' => 0,
- 'name' => 'tex_enable',
- 'value' => 'no',
- },
- {
- 'system_id' => 0,
- 'name' => 'timezone',
- 'value' => 'Europe/Berlin',
- },
- {
- 'system_id' => 0,
- 'name' => 'tvout',
- 'value' => 'no',
- },
- {
- 'system_id' => 0,
- 'name' => 'vmware',
- 'value' => 'no',
- },
- ],
},
'vendor_os' => {
# a vendor-OS describes a folder containing an operating system as
@@ -361,8 +244,10 @@ sub new
sub checkAndUpgradeDBSchemaIfNecessary
{
- my $self = shift;
- my $metaDB = shift;
+ my $self = shift;
+ my $configDB = shift;
+
+ my $metaDB = $configDB->{'meta-db'};
vlog(2, "trying to determine schema version...");
my $currVersion = $metaDB->schemaFetchDBVersion();
@@ -385,6 +270,7 @@ sub checkAndUpgradeDBSchemaIfNecessary
);
}
$metaDB->schemaSetDBVersion($DbSchema->{version});
+ $self->_synchronizeAttributesWithDefaultSystem($configDB);
vlog(1, _tr('DB has been created successfully'));
} elsif ($currVersion < $DbSchema->{version}) {
vlog(
@@ -395,6 +281,7 @@ sub checkAndUpgradeDBSchemaIfNecessary
)
);
$self->_schemaUpgradeDBFrom($metaDB, $currVersion);
+ $self->_synchronizeAttributesWithDefaultSystem($configDB);
vlog(1, _tr('upgrade done'));
} else {
vlog(1, _tr('DB matches current schema version (%s)', $currVersion));
@@ -413,6 +300,33 @@ sub getColumnsOfTable
@{$DbSchema->{tables}->{$tableName}->{cols}};
}
+sub _synchronizeAttributesWithDefaultSystem
+{
+ my $self = shift;
+ my $configDB = shift;
+
+ my $defaultSystem = $configDB->fetchSystemByID(0);
+ return if !$defaultSystem;
+
+ # fetch all known attributes from attribute roster and merge these
+ # into the existing attributes of the default system
+ my $attrInfo = OpenSLX::AttributeRoster::getAttrInfo();
+ foreach my $attr (keys %$attrInfo) {
+ next if exists $defaultSystem->{attrs}->{$attr};
+ $defaultSystem->{attrs}->{$attr} = $attrInfo->{$attr}->{default};
+ }
+
+ # remove unknown attributes from default system
+ my @unknownAttrs
+ = grep { !exists $attrInfo->{$_} } keys %{$defaultSystem->{attrs}};
+ foreach my $unknownAttr (@unknownAttrs) {
+ delete $defaultSystem->{attrs}->{$unknownAttr};
+ }
+
+ # now write back the updated default system
+ return $configDB->changeSystem(0, $defaultSystem);
+}
+
################################################################################
###
### methods for upgrading the DB schema
@@ -426,6 +340,7 @@ sub _schemaUpgradeDBFrom
$self->_upgradeDBTo0_2($metaDB) if $currVersion < 0.2;
$self->_upgradeDBTo0_21($metaDB) if $currVersion < 0.21;
+ $self->_upgradeDBTo0_22($metaDB) if $currVersion < 0.22;
return 1;
}
@@ -671,4 +586,19 @@ sub _upgradeDBTo0_21
return 1;
}
+sub _upgradeDBTo0_22
+{
+ my $self = shift;
+ my $metaDB = shift;
+
+ vlog(0, "upgrading schema version to 0.22");
+
+ # dummy schema change, just to trigger the attribute synchronization
+ # into the default system
+
+ $metaDB->schemaSetDBVersion(0.22);
+
+ return 1;
+}
+
1;
diff --git a/os-plugins/OpenSLX/OSPlugin/Base.pm b/os-plugins/OpenSLX/OSPlugin/Base.pm
new file mode 100644
index 00000000..0f2123d7
--- /dev/null
+++ b/os-plugins/OpenSLX/OSPlugin/Base.pm
@@ -0,0 +1,130 @@
+# Copyright (c) 2006, 2007 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# Base.pm
+# - provides empty base of the OpenSLX OSPlugin API.
+# -----------------------------------------------------------------------------
+package OpenSLX::OSPlugin::Base;
+
+use strict;
+use warnings;
+
+our $VERSION = 1.01; # API-version . implementation-version
+
+use OpenSLX::Basics;
+
+################################################################################
+# if you have any questions regarding the concept of OS-plugins and their
+# implementation, please drop a mail to: ot@openslx.com, or join the IRC-channel
+# '#openslx' (on freenode).
+################################################################################
+
+sub new
+{
+ confess "Creating OpenSLX::OSPlugin::Base-objects directly makes no sense!";
+}
+
+sub initialize
+{
+ my $self = shift;
+
+ # The os-plugin-engine drives us, it provides some useful services relevant
+ # to installing stuff into the vendor-OS, like downloading functionality,
+ # access to meta-packager, ...
+ $self->{'os-plugin-engine'} = shift;
+}
+
+sub getInfo
+{ # returns a hash-ref with administrative information about this plugin
+ # (what does it do and how does it relate to other plugins)
+ my $self = shift;
+
+ return {
+ # a short (one-liner) description of this plugin
+ description => '',
+ # a list of plugins that must have completed before this plugin can
+ # be executed
+ mustRunAfter => [],
+ };
+}
+
+sub getAttrInfo
+{ # returns a hash-ref with information about all attributes supported
+ # by this specific plugin
+ my $self = shift;
+
+ # This default configuration will be added as attributes to the default
+ # system, such that it can be overruled for any specific system & client
+ # by means of slxconfig.
+ return {
+ # attribute 'active' is mandatory for all plugins
+ # attribute 'precedence' is mandatory for all plugins
+ };
+}
+
+sub preInstallationPhase
+{ # called before chrooting into vendor-OS root, should be used if any files
+ # have to be downloaded outside of the chroot (which might be necessary
+ # if the required files can't be installed via the meta-packager)
+ my $self = shift;
+ my $pluginRepositoryPath = shift;
+ # the folder where the stage1-plugin should store all files
+ # required by the corresponding stage3 runlevel script
+ my $pluginTempPath = shift;
+ # a temporary playground that will be cleaned up automatically
+}
+
+sub installationPhase
+{ # called while chrooted to the vendor-OS root, most plugins will do all
+ # their installation work here
+ my $self = shift;
+ my $pluginRepositoryPath = shift;
+ # the repository folder, this time from inside the chroot
+ my $pluginTempPath = shift;
+ # the temporary folder, this time from inside the chroot
+}
+
+sub postInstallationPhase
+{ # called after having returned from chrooted environment, should be used
+ # to cleanup any leftovers, if any such thing is necessary
+ my $self = shift;
+ my $pluginRepositoryPath = shift;
+ my $pluginTempPath = shift;
+}
+
+sub preRemovalPhase
+{ # called before chrooting into vendor-OS root, should be used if any
+ # preparations outside of the chroot have to be made before the plugin
+ # can be removed
+ my $self = shift;
+ my $pluginRepositoryPath = shift;
+ # the folder where the stage1-plugin has stored all files
+ # required by the corresponding stage3 runlevel script
+ my $pluginTempPath = shift;
+ # a temporary playground that will be cleaned up automatically
+}
+
+sub removalPhase
+{ # called while chrooted to the vendor-OS root, most plugins will do all
+ # their uninstallation work here
+ my $self = shift;
+ my $pluginRepositoryPath = shift;
+ # the repository folder, this time from inside the chroot
+ my $pluginTempPath = shift;
+ # the temporary folder, this time from inside the chroot
+}
+
+sub postRemovalPhase
+{ # called after having returned from chrooted environment, should be used
+ # to cleanup any leftovers, if any such thing is necessary
+ my $self = shift;
+ my $pluginRepositoryPath = shift;
+ my $pluginTempPath = shift;
+}
diff --git a/os-plugins/OpenSLX/OSPlugin/Engine.pm b/os-plugins/OpenSLX/OSPlugin/Engine.pm
index 57850229..bdf259f4 100644
--- a/os-plugins/OpenSLX/OSPlugin/Engine.pm
+++ b/os-plugins/OpenSLX/OSPlugin/Engine.pm
@@ -64,6 +64,9 @@ sub initialize
vlog(1, "plugin path is '$self->{'plugin-path'}'");
$self->{'plugin'} = $self->_loadPlugin();
+ return if !$self->{'plugin'};
+
+ return 1;
}
sub installPlugin
@@ -98,6 +101,10 @@ sub installPlugin
);
$self->{plugin}->postInstallationPhase($pluginRepoPath, $pluginTempPath);
+
+ $self->_addInstalledPluginToDB();
+
+ return 1;
}
sub getPlugin
@@ -119,6 +126,51 @@ sub _loadPlugin
my $plugin = instantiateClass(
$pluginModule, { pathToClass => $self->{'plugin-path'} }
);
+ return if !$plugin;
+
$plugin->initialize($self);
+
return $plugin;
}
+
+sub _addInstalledPluginToDB
+{
+ my $self = shift;
+
+ my $openslxDB = instantiateClass("OpenSLX::ConfigDB");
+ $openslxDB->connect();
+ my $vendorOS = $openslxDB->fetchVendorOSByFilter( {
+ name => $self->{'vendor-os-name'},
+ } );
+ if (!$vendorOS) {
+ die _tr(
+ 'unable to find vendor-OS "%s" in DB!', $self->{'vendor-os-name'}
+ );
+ }
+ $openslxDB->addInstalledPlugin($vendorOS->{id}, $self->{'plugin-name'});
+ $openslxDB->disconnect();
+
+ return 1;
+}
+
+sub _removeInstalledPluginFromDB
+{
+ my $self = shift;
+
+ my $openslxDB = instantiateClass("OpenSLX::ConfigDB");
+ $openslxDB->connect();
+ my $vendorOS = $openslxDB->fetchVendorOSByFilter( {
+ name => $self->{'vendor-os-name'},
+ } );
+ if (!$vendorOS) {
+ die _tr(
+ 'unable to find vendor-OS "%s" in DB!', $self->{'vendor-os-name'}
+ );
+ }
+ $openslxDB->removeInstalledPlugin($vendorOS->{id}, $self->{'plugin-name'});
+ $openslxDB->disconnect();
+
+ return 1;
+}
+
+1;
diff --git a/os-plugins/OpenSLX/OSPlugin/Roster.pm b/os-plugins/OpenSLX/OSPlugin/Roster.pm
new file mode 100644
index 00000000..776907e4
--- /dev/null
+++ b/os-plugins/OpenSLX/OSPlugin/Roster.pm
@@ -0,0 +1,56 @@
+# Copyright (c) 2006, 2007 - OpenSLX GmbH
+#
+# This program is free software distributed under the GPL version 2.
+# See http://openslx.org/COPYING
+#
+# If you have any feedback please consult http://openslx.org/feedback and
+# send your suggestions, praise, or complaints to feedback@openslx.org
+#
+# General information about OpenSLX can be found at http://openslx.org/
+# -----------------------------------------------------------------------------
+# OSPlugin::Roster.pm
+# - provides information about all available plugins
+# -----------------------------------------------------------------------------
+package OpenSLX::OSPlugin::Roster;
+
+use strict;
+use warnings;
+
+use OpenSLX::Basics;
+
+=item C<addAllDefaultAttributesToHash()>
+
+Fetches attribute info from all available plugins and adds it to the given
+hash-ref.
+
+=over
+
+=item Return Value
+
+1
+
+=back
+
+=cut
+
+sub addAllDefaultAttributesToHash
+{
+ my $class = shift;
+ my $attrInfo = shift;
+
+ my $pluginPath = "$openslxConfig{'base-path'}/lib/plugins";
+ foreach my $modulePath (glob("$pluginPath/*")) {
+ next if $modulePath !~ m{/([^/]+)$};
+ my $pluginName = $1;
+ my $class = "OpenSLX::OSPlugin::$pluginName";
+ vlog(2, "loading plugin $class from path '$modulePath'");
+ my $plugin = instantiateClass($class, { pathToClass => $modulePath });
+ my $pluginAttrInfo = $plugin->getAttrInfo();
+ foreach my $attr (keys %$pluginAttrInfo) {
+ $attrInfo->{$attr} = $pluginAttrInfo->{$attr};
+ }
+ }
+ return 1;
+}
+
+1;
diff --git a/os-plugins/plugins/Example/OpenSLX/OSPlugin/Example.pm b/os-plugins/plugins/Example/OpenSLX/OSPlugin/Example.pm
index 9ade866a..ec5dd03d 100644
--- a/os-plugins/plugins/Example/OpenSLX/OSPlugin/Example.pm
+++ b/os-plugins/plugins/Example/OpenSLX/OSPlugin/Example.pm
@@ -16,7 +16,7 @@ package OpenSLX::OSPlugin::Example;
use strict;
use warnings;
-our $VERSION = 1.01; # API-version . implementation-version
+use base qw(OpenSLX::OSPlugin::Base);
use OpenSLX::Basics;
use OpenSLX::Utils;
@@ -26,8 +26,6 @@ use OpenSLX::Utils;
# implementation, please drop a mail to: ot@openslx.com, or join the IRC-channel
# '#openslx' (on freenode).
################################################################################
-### interface methods
-################################################################################
sub new
{
my $class = shift;
@@ -37,27 +35,63 @@ sub new
return bless $self, $class;
}
-sub initialize
+sub getInfo
{
my $self = shift;
- # The os-plugin-engine drives us, it provides some useful services relevant
- # to installing stuff into the vendor-OS, like downloading functionality,
- # access to meta-packager, ...
- $self->{'os-plugin-engine'} = shift;
-
- # Any other static initialization necessary for a plugin should be done
- # here, more often than not, this will involve a configurational hash
- # representing the default settings for this plugin.
- # At a later stage, the user will be able to change plugin-specific settings
- # (on a per-system/client basis) via slxconfig, such that the actual
- # configuration will be stored in the DB.
- # Currently, though, you have to change the settings here:
- $self->{config} = {
- 'active' => 1, # set to 0 in order to deactivate
- 'precedence' => 10, # runlevel precedence
- 'preferred_side' => 'left', # just a silly example
- }
+ return {
+ description => unshiftHereDoc(<<' End-of-Here'),
+ just an exemplary plugin that prints a smiley when the client boots
+ End-of-Here
+ mustRunAfter => [],
+ };
+}
+
+sub getAttrInfo
+{ # returns a hash-ref with information about all attributes supported
+ # by this specific plugin
+ my $self = shift;
+
+ # This default configuration will be added as attributes to the default
+ # system, such that it can be overruled for any specific system & client
+ # by means of slxconfig.
+ return {
+ # attribute 'active' is mandatory for all plugins
+ 'example::active' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ should the 'Example'-plugin be executed during boot?
+ End-of-Here
+ content_regex => qr{^(0|1)$},
+ content_descr => '1 means active - 0 means inactive',
+ default => '1',
+ },
+ # attribute 'precedence' is mandatory for all plugins
+ 'example::precedence' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ the execution precedence of the 'Example' plugin
+ End-of-Here
+ content_regex => qr{^\d\d$},
+ content_descr => 'allowed range is from 01-99',
+ default => 50,
+ },
+
+ # plugin specific attributes start here ...
+ 'example::preferred_side' => {
+ applies_to_systems => 1,
+ applies_to_clients => 1,
+ description => unshiftHereDoc(<<' End-of-Here'),
+ determines to which side you have to tilt your head in order
+ to read the smiley
+ End-of-Here
+ content_regex => qr{^(left|right)$},
+ content_descr => q{'left' will print ';-)' - 'right' will print '(-;'},
+ default => 'left',
+ },
+ };
}
sub preInstallationPhase
@@ -98,25 +132,34 @@ sub postInstallationPhase
# in this example plugin, there's no need to do anything here ...
}
-sub getConfig
-{ # called from the config-demuxer in order ot access the configurational
- # hash, which will then be written to a file (in this case:
- # /opt/openslx/plugin-conf/Example.conf), that will be transported to each
- # client as part of the conf-TGZ.
- my $self = shift;
-
- return $self->{config};
-}
-
sub preRemovalPhase
-{
+{ # called before chrooting into vendor-OS root, should be used if any
+ # preparations outside of the chroot have to be made before the plugin
+ # can be removed
+ my $self = shift;
+ my $pluginRepositoryPath = shift;
+ # the folder where the stage1-plugin has stored all files
+ # required by the corresponding stage3 runlevel script
+ my $pluginTempPath = shift;
+ # a temporary playground that will be cleaned up automatically
}
sub removalPhase
-{
+{ # called while chrooted to the vendor-OS root, most plugins will do all
+ # their uninstallation work here
+ my $self = shift;
+ my $pluginRepositoryPath = shift;
+ # the repository folder, this time from inside the chroot
+ my $pluginTempPath = shift;
+ # the temporary folder, this time from inside the chroot
}
sub postRemovalPhase
-{
+{ # called after having returned from chrooted environment, should be used
+ # to cleanup any leftovers, if any such thing is necessary
+ my $self = shift;
+ my $pluginRepositoryPath = shift;
+ my $pluginTempPath = shift;
}
+1;
diff --git a/os-plugins/plugins/VMware/OpenSLX/OSPlugin/VMware.pm b/os-plugins/plugins/VMware/OpenSLX/OSPlugin/VMware.pm
index 4167ffdd..6fddf78c 100644
--- a/os-plugins/plugins/VMware/OpenSLX/OSPlugin/VMware.pm
+++ b/os-plugins/plugins/VMware/OpenSLX/OSPlugin/VMware.pm
@@ -16,7 +16,7 @@ package OpenSLX::OSPlugin::VMware;
use strict;
use warnings;
-our $VERSION = 1.01; # API-version . implementation-version
+use base qw(OpenSLX::OSPlugin::Base);
use OpenSLX::Basics;
use OpenSLX::Utils;
@@ -37,85 +37,16 @@ sub new
return bless $self, $class;
}
-sub initialize
+sub getInfo
{
my $self = shift;
- # The os-plugin-engine drives us, it provides some useful services relevant
- # to installing stuff into the vendor-OS, like downloading functionality,
- # access to meta-packager, ...
- $self->{'os-plugin-engine'} = shift;
-
- # Any other static initialization necessary for a plugin should be done
- # here, more often than not, this will involve a configurational hash
- # representing the default settings for this plugin.
- # At a later stage, the user will be able to change plugin-specific settings
- # (on a per-system/client basis) via slxconfig, such that the actual
- # configuration will be stored in the DB.
- # Currently, though, you have to change the settings here:
- $self->{config} = {
- 'active' => 0, # set to 0 in order to deactivate
- 'precedence' => 10, # runlevel precedence
- }
-}
-
-sub preInstallationPhase
-{ # called before chrooting into vendor-OS root, should be used if any files
- # have to be downloaded outside of the chroot (which might be necessary
- # if the required files can't be installed via the meta-packager)
- my $self = shift;
- my $pluginRepositoryPath = shift;
- # the folder where the stage1-plugin should store all files
- # required by the corresponding stage3 runlevel script
- my $pluginTempPath = shift;
- # a temporary playground that will be cleaned up automatically
-
- # in this example plugin, there's no need to do anything here ...
-}
-
-sub installationPhase
-{ # called while chrooted to the vendor-OS root, most plugins will do all
- # their installation work here
- my $self = shift;
- my $pluginRepositoryPath = shift;
- # the repository folder, this time from inside the chroot
- my $pluginTempPath = shift;
- # the temporary folder, this time from inside the chroot
-
- # for this example plugin, we simply create two files:
- spitFile("$pluginRepositoryPath/right", "(-;\n");
- spitFile("$pluginRepositoryPath/left", ";-)\n");
-}
-
-sub postInstallationPhase
-{ # called after having returned from chrooted environment, should be used
- # to cleanup any leftovers, if any such thing is necessary
- my $self = shift;
- my $pluginRepositoryPath = shift;
- my $pluginTempPath = shift;
-
- # in this example plugin, there's no need to do anything here ...
-}
-
-sub getConfig
-{ # called from the config-demuxer in order ot access the configurational
- # hash, which will then be written to a file (in this case:
- # /opt/openslx/plugin-conf/VMware.conf), that will be transported to each
- # client as part of the conf-TGZ.
- my $self = shift;
-
- return $self->{config};
-}
-
-sub preRemovalPhase
-{
-}
-
-sub removalPhase
-{
-}
-
-sub postRemovalPhase
-{
+ return {
+ description => unshiftHereDoc(<<' End-of-Here'),
+ !!! descriptive text missing here !!!
+ End-of-Here
+ mustRunAfter => [],
+ };
}
+1;