package mirror; # $Id$ use diagnostics; use strict; use feature 'state'; use common; use log; my %land2tzs = ( N_("Australia") => [ 'Australia/Sydney' ], N_("Austria") => [ 'Europe/Vienna', 'Europe/Brussels', 'Europe/Berlin' ], N_("Belgium") => [ 'Europe/Brussels', 'Europe/Paris', 'Europe/Berlin' ], N_("Brazil") => [ 'Brazil/East' ], N_("Canada") => [ 'Canada/Atlantic', 'Canada/Eastern' ], N_("Costa Rica") => [ 'America/Costa_Rica' ], N_("Czech Republic") => [ 'Europe/Prague', 'Europe/Berlin' ], N_("Denmark") => [ 'Europe/Copenhagen', 'Europe/Berlin' ], N_("Estonia") => [ 'Europe/Tallinn', 'Europe/Helsinki' ], N_("Finland") => [ 'Europe/Helsinki', 'Europe/Tallinn' ], N_("France") => [ 'Europe/Paris', 'Europe/Brussels', 'Europe/Berlin' ], N_("Germany") => [ 'Europe/Berlin', 'Europe/Prague' ], N_("Greece") => [ 'Europe/Athens', 'Europe/Prague' ], N_("Hungary") => [ 'Europe/Budapest' ], N_("Ireland") => [ 'Europe/Dublin', 'Europe/London' ], N_("Israel") => [ 'Asia/Tel_Aviv' ], N_("Italy") => [ 'Europe/Rome', 'Europe/Brussels', 'Europe/Paris' ], N_("Japan") => [ 'Asia/Tokyo', 'Asia/Seoul' ], N_("Netherlands") => [ 'Europe/Amsterdam', 'Europe/Brussels', 'Europe/Berlin' ], N_("New Zealand") => [ 'Pacific/Auckland' ], N_("Norway") => [ 'Europe/Oslo', 'Europe/Stockholm' ], N_("Poland") => [ 'Europe/Warsaw' ], N_("Portugal") => [ 'Europe/Lisbon', 'Europe/Madrid' ], N_("Russia") => [ 'Europe/Moscow', ], N_("Slovakia") => [ 'Europe/Bratislava' ], N_("South Africa") => [ 'Africa/Johannesburg' ], N_("Spain") => [ 'Europe/Madrid', 'Europe/Lisbon' ], N_("Sweden") => [ 'Europe/Stockholm', 'Europe/Oslo' ], N_("Switzerland") => [ 'Europe/Zurich', 'Europe/Berlin', 'Europe/Brussels' ], N_("Taiwan") => [ 'Asia/Taipei', 'Asia/Seoul' ], N_("Thailand") => [ 'Asia/Bangkok', 'Asia/Seoul' ], N_("United States") => [ 'America/New_York', 'Canada/Atlantic', 'Asia/Tokyo', 'Australia/Sydney', 'Europe/Paris' ], ); sub mirror2text { my ($mirror) = @_; translate($mirror->{country}) . '|' . $mirror->{host} . ($mirror->{method} ? " ($mirror->{method})" : ''); } my $downloader; sub register_downloader { my ($func) = @_; $downloader = $func; } sub mirrors_raw { my ($product_id) = @_; #- contact the following URL to retrieve the list of mirrors. #- http://wiki.mandriva.com/en/Product_id my $type = lc($product_id->{type}); $type =~ s/\s//g; my $list = "http://api.mandriva.com/mirrors/$type.$product_id->{version}.$product_id->{arch}.list?product=$product_id->{product}"; log::explanations("trying mirror list from $list"); my @lines; if ($::isInstall) { require install::http; my $f = install::http::getFile($list) or die "mirror list not found"; local $SIG{ALRM} = sub { die "timeout" }; alarm 60; log::l("using mirror list $list"); push @lines, $_ while <$f>; install::http::close(); alarm 0; } else { if (ref($downloader)) { @lines = $downloader->($list); @lines or die "mirror list not found"; } else { die "Missing download callback"; } } map { common::parse_LDAP_namespace_structure(chomp_($_)) } @lines; } sub list { my ($product_id, $type) = @_; our @mirrors_raw; if (!@mirrors_raw) { @mirrors_raw = eval { mirrors_raw($product_id) }; if (my $err = $@) { log::explanations("failed to download mirror list"); die $err; } @mirrors_raw or log::explanations("empty mirror list"), return; } my @mirrors = grep { ($_->{method}, $_->{host}, $_->{dir}) = $_->{url} =~ m!^(ftp|http)://(.*?)(/.*)!; $_->{method} && ($type eq 'all' || $_->{type} eq $type); } @mirrors_raw or log::explanations("no mirrors of type $type"), return; @mirrors && \@mirrors; } sub nearest { my ($timezone, $mirrors) = @_; my (@country, @zone); foreach my $mirror (@$mirrors) { my @tzs = @{$land2tzs{$mirror->{country}} || []}; eval { push @{$country[find_index { $_ eq $timezone } @tzs]}, $mirror }; eval { push @{$zone[find_index { ((split '/')[0] eq (split '/', $timezone)[0]) } @tzs]}, $mirror }; } my @l = @country ? @country : @zone; shift @l while !$l[0] && @l; my @possible = @l ? ((@{$l[0]}) x 2, @{$l[1] || []}) : @$mirrors; $possible[rand @possible]; } 1; d='n25' href='#n25'>25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[254] Add params file</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd>254</dd>
<dt>Author</dt> <dd>dmorgan</dd>
<dt>Date</dt> <dd>2010-11-15 01:51:36 +0100 (Mon, 15 Nov 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>Add params file</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#puppetmodulesbugzillamanifestsinitpp">puppet/modules/bugzilla/manifests/init.pp</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#puppetmodulesbugzillatemplatesparams">puppet/modules/bugzilla/templates/params</a></li>
</ul>
</div>
<div id="patch"><pre>
<a id="puppetmodulesbugzillamanifestsinitpp">Modified: puppet/modules/bugzilla/manifests/init.pp</a>
===================================================================
--- puppet/modules/bugzilla/manifests/init.pp 2010-11-12 22:36:51 UTC (rev 253)
+++ puppet/modules/bugzilla/manifests/init.pp 2010-11-15 00:51:36 UTC (rev 254)
@@ -5,13 +5,23 @@
}
$password = extlookup("bugzilla_password")
+ $passwordLdap = extlookup("bugzilla_ldap")
+
file { '/etc/bugzilla/localconfig':
- ensure => present,
- owner => root,
- group => root,
- mode => 644,
- content => template("bugzilla/localconfig")
+ ensure => present,
+ owner => root,
+ group => root,
+ mode => 644,
+ content => template("bugzilla/localconfig")
}
+
+ file { '/var/lib/bugzilla/params':
+ ensure => present,
+ owner => root,
+ group => root,
+ mode => 644,
+ content => template("bugzilla/params")
+ }
}
<a id="puppetmodulesbugzillatemplatesparams">Added: puppet/modules/bugzilla/templates/params</a>
===================================================================
--- puppet/modules/bugzilla/templates/params (rev 0)
+++ puppet/modules/bugzilla/templates/params 2010-11-15 00:51:36 UTC (rev 254)
@@ -0,0 +1,107 @@
+%param = (
+ 'LDAPBaseDN' => 'ou=People,dc=mageia,dc=org',
+ 'LDAPbinddn' => 'cn=bugzilla-alamut,ou=System Accounts,dc=mageia,dc=org:<%= passwordLdap %>',
+ 'LDAPfilter' => '',
+ 'LDAPmailattribute' => 'mail',
+ 'LDAPserver' => 'ldap.mageia.org',
+ 'LDAPstarttls' => '1',
+ 'LDAPuidattribute' => 'uid',
+ 'RADIUS_NAS_IP' => '',
+ 'RADIUS_email_suffix' => '',
+ 'RADIUS_secret' => '',
+ 'RADIUS_server' => '',
+ 'allow_attach_url' => 0,
+ 'allow_attachment_deletion' => 0,
+ 'allow_attachment_display' => 0,
+ 'allowbugdeletion' => 0,
+ 'allowemailchange' => 1,
+ 'allowloginid' => '0',
+ 'allowuserdeletion' => 0,
+ 'announcehtml' => '',
+ 'attachment_base' => '',
+ 'auth_env_email' => '',
+ 'auth_env_id' => '',
+ 'auth_env_realname' => '',
+ 'bonsai_url' => '',
+ 'chartgroup' => 'editbugs',
+ 'commentonchange_resolution' => 0,
+ 'commentonduplicate' => 0,
+ 'confirmuniqueusermatch' => 1,
+ 'cookiedomain' => '',
+ 'cookiepath' => '/',
+ 'createemailregexp' => '.*',
+ 'cvsroot' => '',
+ 'cvsroot_get' => '',
+ 'defaultopsys' => '',
+ 'defaultplatform' => '',
+ 'defaultpriority' => '---',
+ 'defaultquery' => 'bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&emailassigned_to1=1&emailassigned_to2=1&emailreporter2=1&emailcc2=1&emailqa_contact2=1&order=Importance&long_desc_type=substring',
+ 'defaultseverity' => 'enhancement',
+ 'docs_urlbase' => 'docs/%lang%/html/',
+ 'duplicate_or_move_bug_status' => 'RESOLVED',
+ 'emailregexp' => '^[\\w\\.\\+\\-=]+@[\\w\\.\\-]+\\.[\\w\\-]+$',
+ 'emailregexpdesc' => 'A legal address must contain exactly one \'@\', and at least one \'.\' after the @.',
+ 'emailsuffix' => '',
+ 'globalwatchers' => '',
+ 'inbound_proxies' => '',
+ 'insidergroup' => '',
+ 'letsubmitterchoosemilestone' => 1,
+ 'letsubmitterchoosepriority' => 1,
+ 'lxr_root' => '',
+ 'lxr_url' => '',
+ 'mail_delivery_method' => 'Sendmail',
+ 'mailfrom' => 'bugzilla-daemon',
+ 'makeproductgroups' => 0,
+ 'maxattachmentsize' => '1000',
+ 'maxlocalattachment' => '0',
+ 'maxusermatches' => '1000',
+ 'mostfreqthreshold' => '2',
+ 'move-button-text' => 'Move To Bugscape',
+ 'move-enabled' => 0,
+ 'move-to-address' => 'bugzilla-import',
+ 'move-to-url' => '',
+ 'moved-default-component' => '',
+ 'moved-default-product' => '',
+ 'moved-from-address' => 'bugzilla-admin',
+ 'movers' => '',
+ 'musthavemilestoneonaccept' => 0,
+ 'mybugstemplate' => 'buglist.cgi?bug_status=UNCONFIRMED&amp;bug_status=NEW&amp;bug_status=ASSIGNED&amp;bug_status=REOPENED&amp;emailassigned_to1=1&amp;emailreporter1=1&amp;emailtype1=exact&amp;email1=%userid%&amp;field0-0-0=bug_status&amp;type0-0-0=notequals&amp;value0-0-0=UNCONFIRMED&amp;field0-0-1=reporter&amp;type0-0-1=equals&amp;value0-0-1=%userid%',
+ 'noresolveonopenblockers' => 0,
+ 'proxy_url' => '',
+ 'querysharegroup' => 'editbugs',
+ 'quip_list_entry_control' => 'open',
+ 'rememberlogin' => 'on',
+ 'requirelogin' => '0',
+ 'sendmailnow' => 1,
+ 'shadowdb' => '',
+ 'shadowdbhost' => '',
+ 'shadowdbport' => '3306',
+ 'shadowdbsock' => '',
+ 'shutdownhtml' => '',
+ 'smtp_debug' => 0,
+ 'smtp_password' => '',
+ 'smtp_username' => '',
+ 'smtpserver' => 'localhost',
+ 'specific_search_allow_empty_words' => 1,
+ 'ssl_redirect' => 0,
+ 'sslbase' => '',
+ 'strict_isolation' => 0,
+ 'timetrackinggroup' => 'editbugs',
+ 'upgrade_notification' => 'latest_stable_release',
+ 'urlbase' => 'http://bugs.mageia.org/',
+ 'use_mailer_queue' => 0,
+ 'use_see_also' => 1,
+ 'usebugaliases' => 0,
+ 'useclassification' => 0,
+ 'usemenuforusers' => '0',
+ 'useqacontact' => 0,
+ 'user_info_class' => 'CGI',
+ 'user_verify_class' => 'LDAP',
+ 'usestatuswhiteboard' => 0,
+ 'usetargetmilestone' => 0,
+ 'usevisibilitygroups' => 0,
+ 'usevotes' => 0,
+ 'utf8' => 1,
+ 'webdotbase' => 'http://www.research.att.com/~north/cgi-bin/webdot.cgi/%urlbase%',
+ 'whinedays' => 7
+ );
</pre></div>
</body>
</html>