Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: manifests/issuesserver.pp

Issue 29323181: Issue 2782 - Establish cron-job to clean up Trac sessions (Closed)
Patch Set: Created Aug. 3, 2015, 1:59 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 node 'issues1' { 1 node 'issues1' {
2 2
3 include private::trac 3 include private::trac
4 4
5 class {'trac': 5 class {'trac':
6 domain => 'issues.adblockplus.org', 6 domain => 'issues.adblockplus.org',
7 certificate => 'issues.adblockplus.org_sslcert.pem', 7 certificate => 'issues.adblockplus.org_sslcert.pem',
8 private_key => 'issues.adblockplus.org_sslcert.key', 8 private_key => 'issues.adblockplus.org_sslcert.key',
9 is_default => true, 9 is_default => true,
10 } 10 }
(...skipping 26 matching lines...) Expand all
37 CREATE VIEW auth_cookie AS SELECT * FROM trac.auth_cookie;'", 37 CREATE VIEW auth_cookie AS SELECT * FROM trac.auth_cookie;'",
38 unless => "mysql -utrac -p'${private::trac::database_password}' trac_orders --execute ' 38 unless => "mysql -utrac -p'${private::trac::database_password}' trac_orders --execute '
39 SHOW CREATE VIEW auth_cookie'", 39 SHOW CREATE VIEW auth_cookie'",
40 path => "/usr/bin:/usr/sbin:/bin:/usr/local/bin", 40 path => "/usr/bin:/usr/sbin:/bin:/usr/local/bin",
41 require => [ 41 require => [
42 Exec["deploy_issues"], 42 Exec["deploy_issues"],
43 Exec["deploy_orders"], 43 Exec["deploy_orders"],
44 ], 44 ],
45 } 45 }
46 46
47 $mysql = "mysql -utrac -p'${private::trac::database_password}'"
48
47 # Synchronizing e-mail and password information between the project 49 # Synchronizing e-mail and password information between the project
48 # allows for logging in from any entry point - whilst maintaining a 50 # allows for logging in from any entry point - whilst maintaining a
49 # registration form (and process) in one project only. 51 # registration form (and process) in one project only.
50 cron {'trac_session_attribute_sync': 52 cron {'trac_session_attribute_sync':
51 ensure => present, 53 ensure => present,
52 user => trac, 54 user => trac,
53 minute => '*/30', 55 minute => '*/30',
54 command => "mysql -utrac -p'${private::trac::database_password}' trac_orders --execute ' \ 56 command => "$mysql trac_orders --execute ' \
55 INSERT INTO session_attribute (sid, authenticated, name, value) SELECT sid , authenticated, name, value \ 57 INSERT INTO session_attribute (sid, authenticated, name, value) SELECT sid , authenticated, name, value \
56 FROM trac.session_attribute WHERE authenticated = 1 AND name IN (\"email\" , \"password\") \ 58 FROM trac.session_attribute WHERE authenticated = 1 AND name IN (\"email\" , \"password\") \
57 ON DUPLICATE KEY UPDATE value=VALUES(value) ' >/dev/null 59 ON DUPLICATE KEY UPDATE value=VALUES(value) ' >/dev/null
58 ", 60 ",
59 require => Exec['trac_auth_cookie_view'], 61 require => Exec['trac_auth_cookie_view'],
60 } 62 }
61 63
64 cron {'trac_session_cleanup':
65 command => "$mysql trac --execute ' \
66 DELETE session, session_attribute FROM session \
67 JOIN session_attribute ON session.sid = session_attribute.sid \
68 AND session.authenticated = session_attribute.authenticated \
69 WHERE session.authenticated = 0 AND \
70 session.last_visit < UNIX_TIMESTAMP(NOW() - INTERVAL 10 DAY)' >/dev/null",
71 ensure => present,
72 hour => 1,
73 minute => 0,
74 require => Trac::Instance['issues'],
75 user => trac,
76 }
62 } 77 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld