[Fai-commit] r4644 - people/eartoast/addons/class-reference

glaweh-guest at alioth.debian.org glaweh-guest at alioth.debian.org
Sat Oct 20 19:01:00 UTC 2007


Author: glaweh-guest
Date: 2007-10-20 19:00:59 +0000 (Sat, 20 Oct 2007)
New Revision: 4644

Modified:
   people/eartoast/addons/class-reference/fai-classes-config
Log:
add cfengine parser


Modified: people/eartoast/addons/class-reference/fai-classes-config
===================================================================
--- people/eartoast/addons/class-reference/fai-classes-config	2007-10-20 16:51:02 UTC (rev 4643)
+++ people/eartoast/addons/class-reference/fai-classes-config	2007-10-20 19:00:59 UTC (rev 4644)
@@ -58,6 +58,24 @@
 				add_class_ref($2,"$dir/$fname:$."); 
 			}
 		}
+	} elsif ($interpreter =~ m#^(cfengine|cfagent)#) {
+		while (<$fh>) {
+			# remove comments, skip over empty lines
+			s/#.*$//;
+			chomp;
+			next if (/^$/);
+			# extract class references
+			my $line=$.;
+			if (m#(\S+)::(\s|$)#) {
+				$_=$1;
+				# split at class relation characters
+				s/[\.\!\|\(\)]+/ /g;
+				s/^\s+//g;
+				my @now_classes=grep { ! /^any$/ } split;
+				# add reference to the class list
+				map {add_class_ref($_,"$dir/$fname:$.");} @now_classes;
+			}
+		}
 	} else {
 		print STDERR "unknown interpreter $interpreter in $dir/$fname\n";
 	}




More information about the Fai-commit mailing list