[debian-edu-commits] r81281 - in branches/wheezy/debian-edu-config: debian ldap-bootstrap ldap-tools
schweer-guest at alioth.debian.org
schweer-guest at alioth.debian.org
Mon Jul 1 21:00:19 UTC 2013
Author: schweer-guest
Date: 2013-07-01 21:00:19 +0000 (Mon, 01 Jul 2013)
New Revision: 81281
Modified:
branches/wheezy/debian-edu-config/debian/changelog
branches/wheezy/debian-edu-config/ldap-bootstrap/root.ldif
branches/wheezy/debian-edu-config/ldap-tools/sitesummary2ldapdhcp
Log:
* ldap-bootstrap/root.ldif: Add entries for systems of type
workstation, terminal and printer as these should be setup already
during installation of the main server.
* Try to enhance ldap-tools/sitesummary2ldapdhcp, now that more types
for systems are available in LDAP/GOsa?\194?\178:
- Add option -t TYPE, where TYPE could be servers, workstations,
terminals, printers. If this option is omitted, systems are added
as netdevices by default.
- Add code for these options to write the appropriate LDAP entries,
set time server to tjener and activate the system if needed.
Modified: branches/wheezy/debian-edu-config/debian/changelog
===================================================================
--- branches/wheezy/debian-edu-config/debian/changelog 2013-06-30 12:01:54 UTC (rev 81280)
+++ branches/wheezy/debian-edu-config/debian/changelog 2013-07-01 21:00:19 UTC (rev 81281)
@@ -1,3 +1,18 @@
+debian-edu-config (1.708~svn81) UNRELEASED; urgency=low
+
+ * ldap-bootstrap/root.ldif: Add entries for systems of type
+ workstation, terminal and printer as these should be setup already
+ during installation of the main server.
+ * Try to enhance ldap-tools/sitesummary2ldapdhcp, now that more types
+ for systems are available in LDAP/GOsa²:
+ - Add option -t TYPE, where TYPE could be servers, workstations,
+ terminals, printers. If this option is omitted, systems are added
+ as netdevices by default.
+ - Add code for these options to write the appropriate LDAP entries,
+ set time server to tjener and activate the system if needed.
+
+ -- Wolfgang Schweer <wschweer at arcor.de> Mon, 01 Jul 2013 19:04:57 +0200
+
debian-edu-config (1.708~svn81240) wheezy-test; urgency=low
[ Petter Reinholdtsen ]
Modified: branches/wheezy/debian-edu-config/ldap-bootstrap/root.ldif
===================================================================
--- branches/wheezy/debian-edu-config/ldap-bootstrap/root.ldif 2013-06-30 12:01:54 UTC (rev 81280)
+++ branches/wheezy/debian-edu-config/ldap-bootstrap/root.ldif 2013-07-01 21:00:19 UTC (rev 81281)
@@ -50,6 +50,18 @@
objectClass: organizationalUnit
ou: systems
+dn: ou=workstations,ou=systems,dc=skole,dc=skolelinux,dc=no
+objectClass: organizationalUnit
+ou: workstations
+
+dn: ou=terminals,ou=systems,dc=skole,dc=skolelinux,dc=no
+objectClass: organizationalUnit
+ou: terminals
+
+dn: ou=printers,ou=systems,dc=skole,dc=skolelinux,dc=no
+objectClass: organizationalUnit
+ou: printers
+
dn: ou=winstations,ou=systems,dc=skole,dc=skolelinux,dc=no
objectClass: top
objectClass: organizationalUnit
Modified: branches/wheezy/debian-edu-config/ldap-tools/sitesummary2ldapdhcp
===================================================================
--- branches/wheezy/debian-edu-config/ldap-tools/sitesummary2ldapdhcp 2013-06-30 12:01:54 UTC (rev 81280)
+++ branches/wheezy/debian-edu-config/ldap-tools/sitesummary2ldapdhcp 2013-07-01 21:00:19 UTC (rev 81281)
@@ -13,7 +13,7 @@
my %opts;
-getopts("adi:u:", \%opts) || usage(1);
+getopts("adi:u:t:", \%opts) || usage(1);
$debug = 1 if $opts{d};
@@ -21,7 +21,11 @@
my $base = $ARGV[1] || find_ldap_base($server)
|| "dc=skole,dc=skolelinux,dc=no";
-my $systembase = "ou=netdevices,ou=systems,$base";
+my $type = "netdevices";
+if ($opts{t}) {
+ $type = $opts{t}
+}
+my $systembase = "ou=$type,ou=systems,$base";
my $dhcpbase = "cn=dhcp,cn=tjener,ou=servers,ou=systems,$base";
my $userfilter = $opts{u} || "(cn=admin)";
@@ -37,9 +41,11 @@
-d Enable debug output.
-i ID Handle host with the given sitesummary ID only.
-u userfiler Filter used to find LDAP user used to update LDAP.
+ -t TYPE Specify type of system(s) to add. TYPE can be: servers, workstations, terminals \
+ or printers. If -t is omitted, added systems will be of type netdevices.
+EOF
-EOF
- exit $retval;
+exit $retval;
}
my $retval = 0;
@@ -85,7 +91,7 @@
} elsif ($opts{a}) {
my $mac = get_primary_ether_hwaddr($macref);
$mac =~ s/[^0-9a-f-]/-/gi;
- $fqdn = "auto-mac-$mac";
+ $fqdn = "auto-mac-$mac.intern";
print "info: Create GOsa machine for $fqdn [$ipaddr] id $hostid.\n";
$hostinfo{$hostid} = [$fqdn, $ipaddr, $macref, 0];
} else {
@@ -133,27 +139,113 @@
my ($hostname, $dnsdomain) = split(/\./, $fqdn, 2);
my $cn = "cn=$hostname,$systembase";
-
my $mesg = $ldap->search(
base => $base,
- filter => "(&(|(objectClass=goServer)(objectClass=device))(|(cn=$hostname)(macAddress=$mac)))",
+ filter => "(&(|(objectClass=goServer)(objectClass=device)(objectClass=GOhard)(objectClass=gotoWorkstation)(objectClass=gotoTerminal))(|(cn=$hostname)(macAddress=$mac)))",
);
print "info: search found " . $mesg->count . " objects\n" if $debug;
if (0 == $mesg->count) {
- # Create
- my $attr = [
- 'objectClass' => ['top', 'device', 'ipHost', 'ieee802Device'],
- 'cn' => $hostname,
- 'macAddress' => $mac,
- 'ipHostNumber' => $ipaddr,
+ if ($opts{t}) {
+ # Create entry of type $type
+ my $gotoMode = "active";
+ my $gotoSwapServer = "!";
+ my $gotoNtpServer = "tjener";
+ my $ghCpuType = "-";
+ my $ghMemSize = "-";
+ my $ghUsbSupport = "-";
+ my $ghGfxAdapter = "-";
+ my $ghSoundAdapter = "-";
+ my $gotoLastUser = "-";
+ my $printerUri = "DUMMY, please change.";
+ if ($opts{t} eq 'servers') {
+ my $attr = [
+ 'objectClass' => ['top', 'GOhard', 'goServer'],
+ 'cn' => $hostname,
+ 'macAddress' => $mac,
+ 'ipHostNumber' => $ipaddr,
+ 'gotoMode' => $gotoMode,
+ ];
+
+ my $result = $ldap->add($cn, attr => $attr);
+ if ($result->code) {
+ my $err = $result->error;
+ print STDERR "error: Unable to add LDAP object $cn - $err\n";
+
+ }
+ } elsif ($opts{t} eq 'workstations') {
+ my $attr = [
+ 'objectClass' => ['top', 'gotoWorkstation', 'GOhard'],
+ 'cn' => $hostname,
+ 'macAddress' => $mac,
+ 'ipHostNumber' => $ipaddr,
+ 'gotoMode' => $gotoMode,
+ 'gotoNtpServer' => $gotoNtpServer,
+ 'ghCpuType' => $ghCpuType,
+ 'ghMemSize' => $ghMemSize,
+ 'ghUsbSupport' => $ghUsbSupport,
+ 'ghGfxAdapter' => $ghGfxAdapter,
+ 'ghSoundAdapter' => $ghSoundAdapter,
+ 'gotoLastUser' => $gotoLastUser,
+ ];
+
+ my $result = $ldap->add($cn, attr => $attr);
+ if ($result->code) {
+ my $err = $result->error;
+ print STDERR "error: Unable to add LDAP object $cn - $err\n";
+
+ }
+ } elsif ($opts{t} eq 'terminals') {
+ my $attr = [
+ 'objectClass' => ['top', 'gotoTerminal', 'GOhard'],
+ 'cn' => $hostname,
+ 'macAddress' => $mac,
+ 'ipHostNumber' => $ipaddr,
+ 'gotoMode' => $gotoMode,
+ 'gotoNtpServer' => $gotoNtpServer,
+ 'ghCpuType' => $ghCpuType,
+ 'ghMemSize' => $ghMemSize,
+ 'ghUsbSupport' => $ghUsbSupport,
+ 'ghGfxAdapter' => $ghGfxAdapter,
+ 'ghSoundAdapter' => $ghSoundAdapter,
+ 'gotoLastUser' => $gotoLastUser,
+ 'gotoSwapServer' => $gotoSwapServer,
+ ];
+
+ my $result = $ldap->add($cn, attr => $attr);
+ if ($result->code) {
+ my $err = $result->error;
+ print STDERR "error: Unable to add LDAP object $cn - $err\n";
+ }
+ } elsif ($opts{t} eq 'printers') {
+ my $attr = [
+ 'objectClass' => ['top', 'gotoPrinter'],
+ 'cn' => $hostname,
+ 'macAddress' => $mac,
+ 'ipHostNumber' => $ipaddr,
+ 'labeledURI' => $printerUri,
+ ];
+
+ my $result = $ldap->add($cn, attr => $attr);
+ if ($result->code) {
+ my $err = $result->error;
+ print STDERR "error: Unable to add LDAP object $cn - $err\n";
+ }
+ }
+ } else {
+ my $attr = [
+ 'objectClass' => 'dhcpHost',
+ 'cn' => $hostname,
+ 'dhcpHWAddress' => "ethernet $mac",
+ 'dhcpStatements' => "fixed-address $fqdn"
];
- my $result = $ldap->add($cn, attr => $attr);
- if ($result->code) {
- my $err = $result->error;
- print STDERR "error: Unable to add LDAP object $cn - $err\n";
+ my $result = $ldap->add($cn, attr => $attr);
+ if ($result->code) {
+ my $err = $result->error;
+ print STDERR "error: Unable to add LDAP object $cn - $err\n";
+ }
}
} elsif (1 == $mesg->count) {
# Update
More information about the debian-edu-commits
mailing list