From 8fd618a4af920eee687eb565ee34fb294d7dce99 Mon Sep 17 00:00:00 2001 From: Oliver Tappe Date: Fri, 23 Mar 2007 14:03:49 +0000 Subject: * removed this script as it is no longer needed (now that we have slxconfig) git-svn-id: http://svn.openslx.org/svn/openslx/trunk@810 95ad53e4-c205-0410-b2fa-d234c58c8868 --- config-db/devel-tools/create-simple-db.pl | 347 ------------------------------ 1 file changed, 347 deletions(-) delete mode 100755 config-db/devel-tools/create-simple-db.pl (limited to 'config-db/devel-tools') diff --git a/config-db/devel-tools/create-simple-db.pl b/config-db/devel-tools/create-simple-db.pl deleted file mode 100755 index 5fa91073..00000000 --- a/config-db/devel-tools/create-simple-db.pl +++ /dev/null @@ -1,347 +0,0 @@ -#! /usr/bin/perl -# -# create-simple-db.pl - Simple OpenSLX test data generator -# -# (c) 2006 - OpenSLX.com -# -# Oliver Tappe -# -use strict; - -my $abstract = q[ -create-simple-db.pl - This script will generate a very simple OpenSLX test-dataset, useful for - testing and/or trying things out. - - If the OpenSLX configuration database already contains data, the script - will ask for confirmation before clobbering that database. -]; - -use Getopt::Long qw(:config pass_through); -use Pod::Usage; - -# add the lib-folder and the config-db folder to perl's search -# path for modules: -use FindBin; -use lib "$FindBin::RealBin/../../lib"; -use lib "$FindBin::RealBin/.."; - # development path to config-db stuff - -use OpenSLX::Basics; -use OpenSLX::ConfigDB; - -my ( - $clobber, - $helpReq, - $manReq, - $versionReq, -); - -GetOptions( - 'clobber' => \$clobber, - # clobber causes this script to overwrite the database without asking - 'help|?' => \$helpReq, - 'man' => \$manReq, - 'version' => \$versionReq, -); -pod2usage(-msg => $abstract, -verbose => 0, -exitval => 1) if $helpReq; -pod2usage(-verbose => 2) if $manReq; -if ($versionReq) { - system('slxversion'); - exit 1; -} - -openslxInit() or pod2usage(2); - -my $openslxDB = OpenSLX::ConfigDB->new; -$openslxDB->connect(); - -my @systems = $openslxDB->fetchSystemByFilter(); -my $systemCount = scalar(@systems)-1; - # ignore default system -my @clients = $openslxDB->fetchClientByFilter(); -my $clientCount = scalar(@clients)-1; - # ignore default client -if ($systemCount && $clientCount && !$clobber) { - my $yes = _tr('yes'); - my $no = _tr('no'); - print _tr(qq[This will overwrite the current OpenSLX-database with an example dataset. -All your data (%s systems and %s clients) will be lost! -Do you want to continue(%s/%s)? ], $systemCount, $clientCount, $yes, $no); - my $answer = <>; - if ($answer !~ m[^\s*$yes]i) { - print "no - stopping\n"; - exit 5; - } - print "yes - starting...\n"; -} - -$openslxDB->emptyDatabase(); - -my $vendorOs1Id = $openslxDB->addVendorOS({ - 'name' => "suse-10.0", - 'comment' => "SuSE 10.0 Default-Installation", -}); - -my $vendorOs2Id = $openslxDB->addVendorOS({ - 'name' => "suse-10.1", - 'comment' => "SuSE 10.1 Default-Installation", -}); - -my $export1Id = $openslxDB->addExport({ - 'vendor_os_id' => $vendorOs1Id, - 'export_type' => 'nfs', -}); - -my $export2Id = $openslxDB->addExport({ - 'vendor_os_id' => $vendorOs2Id, - 'export_type' => 'nfs', -}); - -my @systems; - -my $system1Id = $openslxDB->addSystem({ - 'name' => "suse-10.0-nfs-vmlinuz", - 'label' => "SUSE LINUX 10.0", - 'comment' => "Testsystem für openslx", - 'export_id' => $export1Id, - 'ramfs_debug_level' => 0, - 'ramfs_use_glibc' => 0, - 'ramfs_use_busybox' => 0, - 'ramfs_nicmods' => '', - 'ramfs_fsmods' => '', - 'kernel' => "vmlinuz", - 'kernel_params' => "debug=8", - 'attr_start_xdmcp' => 'kdm', -}); - -my $system2Id = $openslxDB->addSystem({ - 'name' => "suse-10.1-nfs-vmlinuz", - 'label' => "SUSE LINUX 10.1", - 'comment' => "Testsystem für openslx", - 'export_id' => $export2Id, - 'ramfs_debug_level' => 0, - 'ramfs_use_glibc' => 0, - 'ramfs_use_busybox' => 0, - 'ramfs_nicmods' => '', - 'ramfs_fsmods' => '', - 'kernel' => "vmlinuz", - 'kernel_params' => "debug=8", - 'attr_start_xdmcp' => 'kdm', -}); - -my $client1Id = $openslxDB->addClient({ - 'name' => "Client-1", - 'mac' => "00:50:56:0D:03:38", - 'boot_type' => 'pxe', -}); - -my $client2Id = $openslxDB->addClient({ - 'name' => "Client-2", - 'mac' => "00:16:41:55:12:92", - 'boot_type' => 'pxe', -}); - -$openslxDB->addSystemIDsToClient($client1Id, [$system1Id, $system2Id]); -$openslxDB->addSystemIDsToClient($client2Id, [$system2Id]); - -$openslxDB->disconnect(); - -if ($openslxConfig{'db-type'} =~ m[^\s*csv\s*$]i) { - my $csvFolder = "$openslxConfig{'db-basepath'}/$openslxConfig{'db-name'}-csv"; - print "The test-database with the CSV-files has been created in\n"; - print "\t$csvFolder\n"; - print "You can change the dataset with a simple editor or using\n"; - print "a spreadsheet software like 'OpenOffice Calc' or 'Gnumeric'.\n"; -} - -__END__ - -=head1 NAME - -create-simple-db.pl - Simple OpenSLX test data generator - -=head1 SYNOPSIS - -create-simple-db.pl [options] - - Script Options: - --clobber overwrites config-db without asking - - OpenSLX Options: - --base-path= basic path to project files - --bin-path= path to binaries and scripts - --config-path= path to configuration files - --db-basepath= basic path to openslx database - --db-datadir= data folder created under db-basepath - --db-name= name of database - --db-spec= full DBI-specification of database - --db-type= type of database to connect to - --export-path= path to root of all exported filesystems - --locale= locale to use for translations - --logfile= file to write logging output to - --private-path= path to private data - --public-path= path to public (client-accesible) data - --share-path= path to sharable data - --temp-path= path to temporary data - --tftpboot-path= path to root of tftp-server - --verbose-level= level of logging verbosity (0-3) - - General Options: - --help brief help message - --man full documentation - --version show version - -=head1 OPTIONS - -=head3 Script Options - -=over 8 - -=item B<--clobber> - -Runs the script without asking any questions, B - -=back - -=head3 OpenSLX Options - -=over 8 - -=item B<--base-path=> - -Sets basic path to project files. - -Default is $SLX_BASE_PATH (usually F). - -=item B<--bin-path=> - -Sets path to binaries and scripts. - -Default is $SLX_BASE_PATH/bin (usually F). - -=item B<--config-path=> - -Sets path to configuration files. - -Default is $SLX_CONFIG_PATH (usually F). - -=item B<--db-basepath=> - -Sets basic path to openslx database. - -Default is $SLX_DB_PATH (usually F). - -=item B<--db-datadir=> - -Sets data folder created under db-basepath. - -Default is $SLX_DB_DATADIR (usually empty as it depends on db-type -whether or not such a directory is required at all). - -=item B<--db-name=> - -Gives the name of the database to connect to. - -Default is $SLX_DB_NAME (usually C). - -=item B<--db-spec=> - -Gives the full DBI-specification of database to connect to. Content depends -on the db-type. - -Default is $SLX_DB_SPEC (usually empty as it will be built automatically). - -=item B<--db-type=> - -Sets the type of database to connect to (CSV, SQLite, mysql, ...). - -Default $SLX_DB_TYPE (usually C). - -=item B<--export-path=> - -Sets path to root of all exported filesystems. For each type of export (NFS, -NBD, ...) a separate folder will be created in here. - -Default is $SLX_EXPORT_PATH (usually F. - -=item B<--locale=> - -Sets the locale to use for translations. - -Defaults to the system's standard locale. - -=item B<--logfile=> - -Specifies a file where logging output will be written to. - -Default is to log to STDERR. - -=item B<--private-path=> - -Sets path to private data, where the config-db, vendor_oses and configurational -extensions will be stored. - -Default is $SLX_PRIVATE_PATH (usually F. - -=item B<--public-path=> - -Sets path to public (client-accesible) data. - -Default is $SLX_PUBLIC_PATH (usually F. - -=item B<--share-path=> - -Sets path to sharable data, where distro-specs and functionality templates -will be stored. - -Default is $SLX_SHARE_PATH (usually F. - -=item B<--temp-path=> - -Sets path to temporary data. - -Default is $SLX_TEMP_PATH (usually F. - -=item B<--tftpboot-path=> - -Sets path to root of tftp-server from which clients will access their files. - -Default is $SLX_TFTPBOOT_PATH (usually F. - -=item B<--verbose-level=> - -Sets the level of logging verbosity (0-3). - -Default is $SLX_VERBOSE_LEVEL (usually 0, no logging). - -=back - -=head3 General Options - -=over 8 - -=item B<--help> - -Prints a brief help message and exits. - -=item B<--man> - -Prints the manual page and exits. - -=item B<--version> - -Prints the version and exits. - -=back - -=head1 DESCRIPTION - -B will generate a very simple test-dataset -useful for testing and/or trying things out. - -If the OpenSLX configuration database already contains data, the script -will ask for confirmation before clobbering that database. - -=cut \ No newline at end of file -- cgit v1.2.3-55-g7522