[1841] in Moira Commits
/svn/moira r3988 - trunk/moira/gen
daemon@ATHENA.MIT.EDU (Garry Zacheiss)
Sat Feb 27 01:24:41 2010
Date: Sat, 27 Feb 2010 01:24:35 -0500
From: Garry Zacheiss <zacheiss@MIT.EDU>
Message-Id: <201002270624.o1R6OZP1028720@drugstore.mit.edu>
To: moira-commits@mit.edu
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Author: zacheiss
Date: 2010-02-27 01:24:35 -0500 (Sat, 27 Feb 2010)
New Revision: 3988
Modified:
trunk/moira/gen/boot.pc
trunk/moira/gen/cups-cluster.pc
trunk/moira/gen/cups-print.pc
trunk/moira/gen/dhcp.pc
trunk/moira/gen/hesiod.pc
trunk/moira/gen/print.pc
Log:
Only output printer definitions if the printer is status 1, and its associated host record isn't deleted.
Modified: trunk/moira/gen/boot.pc
===================================================================
--- trunk/moira/gen/boot.pc 2010-02-25 19:53:43 UTC (rev 3987)
+++ trunk/moira/gen/boot.pc 2010-02-27 06:24:35 UTC (rev 3988)
@@ -89,9 +89,10 @@
EXEC SQL DECLARE csr_boot CURSOR FOR
SELECT LOWER(m.name), m.hwaddr, m.address, m2.address,
pr.location, pr.contact, pr.hwtype
- FROM printers pr, machine m, machine m2
+ FROM printers pr, machine m, machine m2, machine m3
WHERE pr.type != 'ALIAS' AND pr.mach_id != 0
AND pr.mach_id = m.mach_id AND pr.loghost = m2.mach_id
+ AND pr.status = 1 and pr.mach_id = m3.mach_id AND m3.status !=3
ORDER BY m.hwaddr;
EXEC SQL OPEN csr_boot;
while (1)
@@ -146,8 +147,8 @@
pr.location, pr.contact, TO_CHAR(pr.modtime, :unixtime_fmt)
FROM printers pr, machine m, machine m2, machine m3
WHERE pr.hwtype LIKE 'HP%' AND pr.mach_id != 0
- AND pr.mach_id = m.mach_id AND pr.rm = m2.mach_id
- AND pr.loghost = m3.mach_id AND pr.type != 'ALIAS';
+ AND pr.mach_id = m.mach_id AND m.status !=3 AND pr.rm = m2.mach_id
+ AND pr.loghost = m3.mach_id AND pr.type != 'ALIAS' AND pr.status = 1;
EXEC SQL OPEN csr_boot2;
while (1)
{
Modified: trunk/moira/gen/cups-cluster.pc
===================================================================
--- trunk/moira/gen/cups-cluster.pc 2010-02-25 19:53:43 UTC (rev 3987)
+++ trunk/moira/gen/cups-cluster.pc 2010-02-27 06:24:35 UTC (rev 3988)
@@ -157,6 +157,7 @@
pr.ac, pr.lpc_acl
FROM printers pr, machine m
WHERE pr.rm = :rm AND m.mach_id = pr.mach_id
+ AND pr.status = 1 AND m.status !=3
AND (pr.type = 'DORM' or pr.type = 'CLUSTER');
EXEC SQL OPEN csr_printers;
while (1)
@@ -234,8 +235,9 @@
SELECT pr.rp, pr.name, pr.duplexname, pr.hwtype,
m.name, pr.banner, pr.location, pr.contact, pr.ka,
pr.ac, pr.lpc_acl, m.name as cupshosts
- FROM printers pr, machine m, serverhosts sh
+ FROM printers pr, machine m, machine m2, serverhosts sh
WHERE pr.rm = m.mach_id
+ AND pr.status = 1 AND pr.mach_id = m2.mach_id AND m2.status !=3
AND (pr.type = 'CLUSTER' or pr.type = 'DORM') AND m.name <> :spoolhost AND
m.mach_id = sh.mach_id AND (sh.service = 'CUPS-PRINT' OR sh.service = 'CUPS-CLUSTER') AND
sh.enable = 1 AND m.mach_id = sh.mach_id;
@@ -310,8 +312,9 @@
SELECT pr.rp, pr.name, pr.duplexname, pr.hwtype,
m.name, pr.banner, pr.location, pr.contact, pr.ka,
pr.ac, pr.lpc_acl, m.name as cupshosts
- FROM printers pr, machine m, serverhosts sh
+ FROM printers pr, machine m, machine m2, serverhosts sh
WHERE pr.rm = m.mach_id
+ AND pr.status = 1 and pr.mach_id = m2.mach_id AND m2.status !=3
AND (pr.type = 'DORM' or pr.type = 'CLUSTER') AND m.name <> :spoolhost AND
m.mach_id = sh.mach_id AND sh.service = 'PRINT' AND
sh.enable = 1;
@@ -373,8 +376,9 @@
SELECT pr.rp, pr.name, pr.duplexname, pr.hwtype,
m.name, pr.banner, pr.location, pr.contact, pr.ka,
pr.type as prtype, pr.ac, sh.service
- FROM printers pr, machine m, serverhosts sh
+ FROM printers pr, machine m, machine m2, serverhosts sh
WHERE pr.rm = m.mach_id
+ AND pr.status = 1 and pr.mach_id = m2.mach_id AND m2.status !=3
AND m.mach_id = sh.mach_id AND sh.enable = 1
AND (pr.type = 'DORM' or pr.type = 'CLUSTER')
AND (sh.service = 'CUPS-PRINT' OR sh.service = 'PRINT' OR sh.service = 'CUPS-CLUSTER');
@@ -576,9 +580,11 @@
top level for each new policy since CUPS doesn't have a way of
doing it otherwise (well, Unix groups, but not moira) */
EXEC SQL DECLARE csr_lpc CURSOR FOR
- SELECT UNIQUE rp, ka, ac, lpc_acl
- FROM printers
- WHERE (ac != 0 OR lpc_acl != 0) AND rm in (SELECT m.mach_id FROM machine m, serverhosts sh
+ SELECT UNIQUE pr.rp, pr.ka, pr.ac, pr.lpc_acl
+ FROM printers pr, machine m
+ WHERE (pr.ac != 0 OR pr.lpc_acl != 0)
+ AND pr.status = 1 and pr.mach_id = m.mach_id AND m.status !=3
+ AND pr.rm in (SELECT m.mach_id FROM machine m, serverhosts sh
WHERE m.mach_id = sh.mach_id AND (sh.service = 'CUPS-PRINT' or sh.service = 'CUPS-CLUSTER')
AND sh.enable = 1);
EXEC SQL OPEN csr_lpc;
Modified: trunk/moira/gen/cups-print.pc
===================================================================
--- trunk/moira/gen/cups-print.pc 2010-02-25 19:53:43 UTC (rev 3987)
+++ trunk/moira/gen/cups-print.pc 2010-02-27 06:24:35 UTC (rev 3988)
@@ -160,6 +160,7 @@
pr.ac, pr.lpc_acl
FROM printers pr, machine m
WHERE pr.rm = :rm AND m.mach_id = pr.mach_id
+ AND pr.status = 1 AND m.status !=3
AND pr.type != 'ALIAS';
EXEC SQL OPEN csr_printers;
while (1)
@@ -237,8 +238,9 @@
SELECT pr.rp, pr.name, pr.duplexname, pr.hwtype,
m.name, pr.banner, pr.location, pr.contact, pr.ka,
pr.ac, pr.lpc_acl, m.name as cupshosts
- FROM printers pr, machine m, serverhosts sh
+ FROM printers pr, machine m, machine m2, serverhosts sh
WHERE pr.rm = m.mach_id
+ AND pr.status = 1 AND pr.mach_id = m2.mach_id AND m2.status !=3
AND pr.type != 'ALIAS' AND m.name <> :spoolhost AND
m.mach_id = sh.mach_id AND (sh.service = 'CUPS-PRINT' OR sh.service = 'CUPS-CLUSTER')
AND sh.enable = 1 AND m.mach_id = sh.mach_id;
@@ -313,8 +315,9 @@
SELECT pr.rp, pr.name, pr.duplexname, pr.hwtype,
m.name, pr.banner, pr.location, pr.contact, pr.ka,
pr.ac, pr.lpc_acl, m.name as cupshosts
- FROM printers pr, machine m, serverhosts sh
+ FROM printers pr, machine m, machine m2, serverhosts sh
WHERE pr.rm = m.mach_id
+ AND pr.status = 1 AND pr.mach_id = m2.mach_id AND m2.status !=3
AND pr.type != 'ALIAS' AND m.name <> :spoolhost AND
m.mach_id = sh.mach_id AND sh.service = 'PRINT' AND
sh.enable = 1;
@@ -376,8 +379,9 @@
SELECT pr.rp, pr.name, pr.duplexname, pr.hwtype,
m.name, pr.banner, pr.location, pr.contact, pr.ka,
pr.type as prtype, pr.ac, sh.service
- FROM printers pr, machine m, serverhosts sh
+ FROM printers pr, machine m, machine m2, serverhosts sh
WHERE pr.rm = m.mach_id
+ AND pr.status = 1 AND pr.mach_id = m2.mach_id AND m2.status !=3
AND m.mach_id = sh.mach_id AND sh.enable = 1
AND (sh.service = 'CUPS-PRINT' OR sh.service = 'PRINT' OR sh.service = 'CUPS-CLUSTER');
EXEC SQL OPEN csr_duplexqs;
@@ -583,9 +587,11 @@
top level for each new policy since CUPS doesn't have a way of
doing it otherwise (well, Unix groups, but not moira) */
EXEC SQL DECLARE csr_lpc CURSOR FOR
- SELECT UNIQUE rp, ka, ac, lpc_acl
- FROM printers
- WHERE (ac != 0 OR lpc_acl != 0) AND rm in (SELECT m.mach_id FROM machine m, serverhosts sh
+ SELECT UNIQUE pr.rp, pr.ka, pr.ac, pr.lpc_acl
+ FROM printers pr, machine m
+ WHERE (pr.ac != 0 OR pr.lpc_acl != 0)
+ AND pr.status = 1 and pr.mach_id = m.mach_id AND m.status !=3
+ AND pr.rm in (SELECT m.mach_id FROM machine m, serverhosts sh
WHERE m.mach_id = sh.mach_id AND (sh.service = 'CUPS-PRINT' OR sh.service = 'CUPS-CLUSTER')
AND sh.enable = 1);
EXEC SQL OPEN csr_lpc;
Modified: trunk/moira/gen/dhcp.pc
===================================================================
--- trunk/moira/gen/dhcp.pc 2010-02-25 19:53:43 UTC (rev 3987)
+++ trunk/moira/gen/dhcp.pc 2010-02-27 06:24:35 UTC (rev 3988)
@@ -102,9 +102,10 @@
EXEC SQL DECLARE csr_boot CURSOR FOR
SELECT LOWER(m.name), m.hwaddr, m.address, m2.address,
pr.location, pr.contact, pr.hwtype
- FROM printers pr, machine m, machine m2
+ FROM printers pr, machine m, machine m2, machine m3
WHERE pr.type != 'ALIAS' AND pr.mach_id != 0
AND pr.mach_id = m.mach_id AND pr.loghost = m2.mach_id
+ AND pr.status = 1 and pr.mach_id = m.mach_id AND m.status !=3
ORDER BY m.hwaddr;
EXEC SQL OPEN csr_boot;
while (1)
@@ -164,8 +165,8 @@
pr.location, pr.contact, TO_CHAR(pr.modtime, :unixtime_fmt)
FROM printers pr, machine m, machine m2, machine m3
WHERE pr.hwtype LIKE 'HP%' AND pr.mach_id != 0
- AND pr.mach_id = m.mach_id AND pr.rm = m2.mach_id
- AND pr.loghost = m3.mach_id AND pr.type != 'ALIAS';
+ AND pr.mach_id = m.mach_id AND m.status != 3 AND pr.rm = m2.mach_id
+ AND pr.loghost = m3.mach_id AND pr.type != 'ALIAS' AND pr.status = 1;
EXEC SQL OPEN csr_boot2;
while (1)
{
Modified: trunk/moira/gen/hesiod.pc
===================================================================
--- trunk/moira/gen/hesiod.pc 2010-02-25 19:53:43 UTC (rev 3987)
+++ trunk/moira/gen/hesiod.pc 2010-02-27 06:24:35 UTC (rev 3988)
@@ -879,8 +879,9 @@
EXEC SQL DECLARE p_cursor2 CURSOR FOR
SELECT p.name, p.duplexname, p.type, p.rp, p.rm, p.ka, p.mc, ps.kind
- FROM printers p, printservers ps
- WHERE p.rm = ps.mach_id;
+ FROM printers p, printservers ps, machine m
+ WHERE p.rm = ps.mach_id AND p.status = 1 AND p.mach_id = m.mach_id
+ AND m.status != 3;
EXEC SQL OPEN p_cursor2;
while (1)
{
Modified: trunk/moira/gen/print.pc
===================================================================
--- trunk/moira/gen/print.pc 2010-02-25 19:53:43 UTC (rev 3987)
+++ trunk/moira/gen/print.pc 2010-02-27 06:24:35 UTC (rev 3988)
@@ -94,6 +94,7 @@
m.name, pr.banner, pr.location, pr.contact
FROM printers pr, machine m
WHERE pr.rm = :rm AND m.mach_id = pr.mach_id
+ AND pr.status = 1 AND m.status != 3
AND pr.type != 'ALIAS'
AND ( pr.hwtype LIKE 'HP%' OR pr.hwtype LIKE 'LPR%' );
EXEC SQL OPEN csr_printcap;
@@ -174,8 +175,9 @@
fprintf(out, "# Printer-specific LPC ACLs\n");
EXEC SQL DECLARE csr_lpc CURSOR FOR
- SELECT rp, duplexname FROM printers
- WHERE rm = :rm AND lpc_acl != 0;
+ SELECT pr.rp, pr.duplexname FROM printers pr, machine m
+ WHERE pr.rm = :rm AND pr.lpc_acl != 0
+ AND pr.status = 1 and pr.mach_id = m.mach_id AND m.status !=3;
EXEC SQL OPEN csr_lpc;
while (1)
{
@@ -194,8 +196,9 @@
fprintf(out, "# Reject jobs from unauthorized users to restricted queues\n");
EXEC SQL DECLARE csr_ac CURSOR FOR
- SELECT rp, duplexname, ka FROM printers
- WHERE rm = :rm AND ac != 0;
+ SELECT pr.rp, pr.duplexname, pr.ka FROM printers pr, machine m
+ WHERE pr.rm = :rm AND pr.ac != 0
+ AND pr.status = 1 and pr.mach_id = m.mach_id AND m.status !=3;
EXEC SQL OPEN csr_ac;
while (1)
{
@@ -239,8 +242,9 @@
out = tarfile_start(tf, "/var/spool/printer/queues.secure", 0755, 1, 1,
"daemon", "daemon", now);
EXEC SQL DECLARE csr_kq CURSOR FOR
- SELECT rp, duplexname FROM printers
- WHERE rm = :rm AND ka = 1;
+ SELECT pr.rp, pr.duplexname FROM printers pr, machine m
+ WHERE pr.rm = :rm AND pr.ka = 1
+ AND pr.status = 1 and pr.mach_id = m.mach_id AND m.status !=3;
EXEC SQL OPEN csr_kq;
while (1)
{
@@ -258,9 +262,10 @@
/* restrict lists and lpcaccess files */
EXEC SQL DECLARE csr_spool CURSOR FOR
- SELECT UNIQUE rp, ka, ac, lpc_acl
- FROM printers
- WHERE rm = :rm AND ( ac != 0 OR lpc_acl != 0);
+ SELECT UNIQUE pr.rp, pr.ka, pr.ac, pr.lpc_acl
+ FROM printers pr, machine m
+ WHERE pr.rm = :rm AND ( pr.ac != 0 OR pr.lpc_acl != 0)
+ AND pr.status = 1 and pr.mach_id = m.mach_id AND m.status !=3;
EXEC SQL OPEN csr_spool;
while (1)
{