]> git.donarmstrong.com Git - dsa-puppet.git/blob - modules/motd/templates/motd.erb
massive style guide fixups
[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.  By using
4 this machine you agree to abide by the Debian Machines Usage Policies
5 <URL:http://www.debian.org/devel/dmup>.
6
7 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8
9 <%=
10 def wrap(s, width=78)
11       s.gsub(/(.{1,#{width}})(\s+|\Z)/, "\\1\n")
12 end
13
14 def markup(l)
15   l = l.gsub(/\[\[(.*?)\|(.*?)\]\]/, '\2')
16   l = l.gsub(/\[\[(\*|-)?(.*?)\]\]/, '\2')
17   return l
18 end
19
20 purp = ''
21 if scope.lookupvar('site::nodeinfo').has_key?('nameinfo')
22   purp += wrap(scope.lookupvar('site::nodeinfo')['nameinfo']) + "\n\n"
23 end
24
25 purp += 'Welcome to ' + fqdn
26 if (scope.lookupvar('site::nodeinfo')['ldap'].has_key?('purpose'))
27   p = scope.lookupvar('site::nodeinfo')['ldap']['purpose'].clone()
28   extra = ''
29
30   if p.delete('buildd')
31     purp += ", the Debian "
32     if scope.lookupvar('site::nodeinfo')['ldap'].has_key?('architecture')
33       purp += scope.lookupvar('site::nodeinfo')['ldap']['architecture'][0]
34     end
35     purp += " build daemon"
36   end
37
38   if p.delete('porterbox')
39     purp += ", the Debian "
40     if scope.lookupvar('site::nodeinfo')['ldap'].has_key?('architecture')
41       purp += scope.lookupvar('site::nodeinfo')['ldap']['architecture'][0]
42     end
43     purp += " porterbox"
44     extra += "\n"
45     extra += "See 'dchroot -l' or 'schroot -l' for a list of available chroots.\n"
46     if scope.lookupvar('site::nodeinfo')['ldap'].has_key?('admin')
47       extra += "Please contact #{nodeinfo['ldap']['admin'][0]} for install requests,\n"
48       extra += "following the recommendations in <URL:http://dsa.debian.org/doc/install-req/>.\n"
49     end
50   end
51
52   if p.size() > 0
53     purp += ", used for the following services:\n"
54     scope.lookupvar('site::nodeinfo')['ldap']['purpose'].sort.each do |l|
55       l = markup(l)
56       purp += "\t" + l + "\n"
57     end
58   else
59     purp += ".\n"
60   end
61
62   purp += extra
63 else
64   purp += ".\n"
65 end
66
67 purp += "\n"
68
69 if (scope.lookupvar('site::nodeinfo')['ldap'].has_key?('physicalHost'))
70   purp += wrap("This virtual server runs on the physical host #{nodeinfo['ldap']['physicalHost'][0]}, " +
71                "which is hosted at #{nodeinfo['hoster']['longname']}."
72                )
73 elsif scope.lookupvar('site::nodeinfo')['hoster']['name']
74   purp += wrap("This server is hosted at #{nodeinfo['hoster']['longname']}.")
75 end
76
77
78 vms = []
79 scope.lookupvar('site::allnodeinfo').keys.sort.each do |node|
80   if scope.lookupvar('site::allnodeinfo')[node]['physicalHost'] and scope.lookupvar('site::allnodeinfo')[node]['physicalHost'].include?(fqdn)
81     vms << node
82   end
83 end
84 unless vms.empty?
85   purp += "\nThe following virtual machines run on this system:\n"
86   vms.each do |node|
87     purp += "\t- #{node}"
88     if scope.lookupvar('site::allnodeinfo')[node]['purpose']
89       purp += ":\n"
90       scope.lookupvar('site::allnodeinfo')[node]['purpose'].sort.each do |l|
91         l = markup(l)
92         purp += "\t    " + l + "\n"
93       end
94     else
95       purp += "\n"
96     end
97   end
98 end
99
100
101 if scope.lookupvar('site::nodeinfo').has_key?('footer')
102   purp += "\n" + wrap(scope.lookupvar('site::nodeinfo')['footer']) + "\n"
103 end
104 purp
105 -%>
106
107 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
108
109 <%
110 # vim:set et:
111 # vim:set sts=2 ts=2:
112 # vim:set shiftwidth=2:
113 -%>