Merge ~hloeung/ubuntu-repository-cache:fixes into ubuntu-repository-cache:master

Proposed by Haw Loeung
Status: Merged
Approved by: Loïc Gomez
Approved revision: 9338706dcc04a8831d5f8bc5666416d43ad9d264
Merged at revision: 49fa67095e15571a6f9bc50376fab13a5f7f4778
Proposed branch: ~hloeung/ubuntu-repository-cache:fixes
Merge into: ubuntu-repository-cache:master
Diff against target: 77 lines (+8/-1)
3 files modified
lib/ubuntu_repository_cache/apache.py (+1/-0)
templates/apache2/archive_ubuntu_com.conf (+1/-1)
tests/unit/test_apache.py (+6/-0)
Reviewer Review Type Date Requested Status
Loïc Gomez +1 Approve
Canonical IS Reviewers Pending
Review via email: mp+432274@code.launchpad.net

Commit message

Fix logging of correct client IP

Description of the change

This is fallout from commit d5a138d7

To post a comment you must log in.
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

This merge proposal is being monitored by mergebot. Change the status to Approved to merge.

Revision history for this message
Loïc Gomez (kotodama) :
review: Approve (+1)
Revision history for this message
🤖 Canonical IS Merge Bot (canonical-is-mergebot) wrote :

Change successfully merged at revision 49fa67095e15571a6f9bc50376fab13a5f7f4778

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/lib/ubuntu_repository_cache/apache.py b/lib/ubuntu_repository_cache/apache.py
2index 0ce7cee..6144612 100644
3--- a/lib/ubuntu_repository_cache/apache.py
4+++ b/lib/ubuntu_repository_cache/apache.py
5@@ -211,6 +211,7 @@ def create_metadata_site(config=None, apache2_conf_path='/etc/apache2'):
6 apache_context['Sync_Host'] = config['sync-host']
7 apache_context['Display_Host'] = config['display-host']
8 apache_context['Path_Base'] = config['path-base']
9+ apache_context['RemoteIP_Logging'] = config['remoteip_logging']
10 metaproxy_conf = '# No failover configured'
11 failover_host = util.get_failover_host()
12 if util.in_failover() and failover_host:
13diff --git a/templates/apache2/archive_ubuntu_com.conf b/templates/apache2/archive_ubuntu_com.conf
14index dc0c40e..8d10df7 100644
15--- a/templates/apache2/archive_ubuntu_com.conf
16+++ b/templates/apache2/archive_ubuntu_com.conf
17@@ -13,7 +13,7 @@
18 ServerAlias ftp.ubuntulinux.org
19 ServerAlias ftp.no-name-yet.com
20
21- LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\" (%D)" combined_with_request_time
22+ LogFormat "{% if RemoteIP_Logging %}%a{% else %}%h{% endif %} %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\" (%D)" combined_with_request_time
23 CustomLog /var/log/apache2/archive.ubuntu.com-access.log combined_with_request_time
24 ErrorLog /var/log/apache2/archive.ubuntu.com-error.log
25
26diff --git a/tests/unit/test_apache.py b/tests/unit/test_apache.py
27index a36b5cb..84d48b8 100644
28--- a/tests/unit/test_apache.py
29+++ b/tests/unit/test_apache.py
30@@ -95,6 +95,7 @@ class TestCharm(unittest.TestCase):
31 'display-host': 'archive.ubuntu.com',
32 'enable_healthcheck': True,
33 'path-base': 'ubuntu',
34+ 'remoteip_logging': False,
35 'sync-host': 'us.archive.ubuntu.com',
36 }
37 )
38@@ -110,6 +111,7 @@ class TestCharm(unittest.TestCase):
39 'display-host': 'archive.ubuntu.com',
40 'enable_healthcheck': True,
41 'path-base': 'ubuntu',
42+ 'remoteip_logging': False,
43 'sync-host': 'us.archive.ubuntu.com',
44 }
45 )
46@@ -127,6 +129,7 @@ class TestCharm(unittest.TestCase):
47 'display-host': 'archive.ubuntu.com',
48 'enable_healthcheck': True,
49 'path-base': 'ubuntu',
50+ 'remoteip_logging': False,
51 'sync-host': 'us.archive.ubuntu.com',
52 }
53 )
54@@ -144,6 +147,7 @@ class TestCharm(unittest.TestCase):
55 'Sync_Host': 'us.archive.ubuntu.com',
56 'Display_Host': 'archive.ubuntu.com',
57 'Path_Base': 'ubuntu',
58+ 'RemoteIP_Logging': False,
59 'MetadataProxy': 'ProxyRemote http://archive.ubuntu.com/ http://10.1.1.1:80\n'
60 + '\tProxyPass / http://archive.ubuntu.com/\n'
61 + '\tProxyPassReverse / http://archive.ubuntu.com/',
62@@ -162,6 +166,7 @@ class TestCharm(unittest.TestCase):
63 'display-host': 'archive.ubuntu.com',
64 'enable_healthcheck': True,
65 'path-base': 'ubuntu',
66+ 'remoteip_logging': False,
67 'sync-host': 'us.archive.ubuntu.com',
68 }
69 )
70@@ -177,6 +182,7 @@ class TestCharm(unittest.TestCase):
71 'Sync_Host': 'us.archive.ubuntu.com',
72 'Display_Host': 'archive.ubuntu.com',
73 'Path_Base': 'ubuntu',
74+ 'RemoteIP_Logging': False,
75 'MetadataProxy': '# No failover configured',
76 'Enable_Healthcheck': True,
77 },

Subscribers

People subscribed via source and target branches