]> git.donarmstrong.com Git - dsa-puppet.git/blob - modules/motd/templates/motd.erb
line wrap motd
[dsa-puppet.git] / modules / motd / templates / motd.erb
1
2 This device is for authorized users only.  All traffic on this device
3 is monitored and will be used as evidence for prosecutions.
4
5 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
6
7 <%=
8 def wrap(s, width=78)
9       s.gsub(/(.{1,#{width}})(\s+|\Z)/, "\\1\n")
10 end
11
12 purp = ''
13 if nodeinfo.has_key?('nameinfo')
14   purp += wrap(nodeinfo['nameinfo']) + "\n\n"
15 end
16
17 purp += 'Welcome to ' + fqdn
18 if (nodeinfo['ldap'].at(0)) and (nodeinfo['ldap'][0].has_key?('purpose'))
19   if nodeinfo['ldap'][0]['purpose'].include?('buildd')
20     purp += ", the Debian "
21     if nodeinfo['ldap'][0].has_key?('architecture')
22       purp += nodeinfo['ldap'][0]['architecture'][0]
23     end
24     purp += " build daemon\n"
25   elsif nodeinfo['ldap'][0]['purpose'].include?('porterbox')
26     purp += ", the Debian "
27     if nodeinfo['ldap'][0].has_key?('architecture')
28       purp += nodeinfo['ldap'][0]['architecture'][0]
29     end
30     purp += " porterbox\n"
31   else
32     purp += ", used for the following services:\n"
33     nodeinfo['ldap'][0]['purpose'].sort.each do |l|
34       if l =~ /\[\[(\*|-)?(.*?)\]\]/
35         l = $2
36       end
37       if l =~ /\[\[(.*?)\|(.*?)\]\]/
38         l = $2
39       end
40       purp += "\t" + l + "\n"
41     end
42   end
43 else
44   purp += "\n"
45 end
46
47 if nodeinfo.has_key?('footer')
48   purp += "\n" + nodeinfo['footer'] + "\n"
49 end
50 purp
51 -%>
52
53 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
54