Merge lp:~therve/landscape-client/configure-ping-time into lp:~landscape/landscape-client/trunk

Proposed by Thomas Herve
Status: Merged
Approved by: Alberto Donato
Approved revision: 360
Merged at revision: 361
Proposed branch: lp:~therve/landscape-client/configure-ping-time
Merge into: lp:~landscape/landscape-client/trunk
Diff against target: 72 lines (+16/-5)
4 files modified
landscape/broker/config.py (+3/-0)
landscape/broker/service.py (+2/-1)
landscape/broker/tests/test_config.py (+5/-3)
landscape/broker/tests/test_service.py (+6/-1)
To merge this branch: bzr merge lp:~therve/landscape-client/configure-ping-time
Reviewer Review Type Date Requested Status
Alberto Donato (community) Approve
Kevin McDermott (community) Approve
Review via email: mp+72207@code.launchpad.net

Description of the change

A fairly simple change I hope.

To post a comment you must log in.
Revision history for this message
Kevin McDermott (bigkevmcd) wrote :

Fairly simple change, the main reason this sat unfixed is because of the ComputerOfflineAlert.

Should we restrict the ping time to no more than 4 minutes? Otherwise it will trigger...

Or we need to do some work to either report it, or disable it or something.

Am happy enough with this fix, but it presents some problems for people using it (outside of load-testing).

review: Approve
Revision history for this message
Alberto Donato (ack) wrote :

Looks good, +1

review: Approve
Revision history for this message
Thomas Herve (therve) wrote :

Kevin: yeah I think we should try to configure the alert, but it's a longer term goal. Right now you can just deactivate the alert.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'landscape/broker/config.py'
2--- landscape/broker/config.py 2011-06-29 17:50:48 +0000
3+++ landscape/broker/config.py 2011-08-19 15:49:30 +0000
4@@ -70,6 +70,9 @@
5 parser.add_option("--ping-url",
6 help="The URL to perform lightweight exchange "
7 "initiation with.")
8+ parser.add_option("--ping-interval", default=30, type="int",
9+ metavar="INTERVAL",
10+ help="The number of seconds between pings.")
11 parser.add_option("--http-proxy", metavar="URL",
12 help="The URL of the HTTP proxy, if one is needed.")
13 parser.add_option("--https-proxy", metavar="URL",
14
15=== modified file 'landscape/broker/service.py'
16--- landscape/broker/service.py 2011-07-21 23:55:47 +0000
17+++ landscape/broker/service.py 2011-08-19 15:49:30 +0000
18@@ -62,7 +62,8 @@
19 self.reactor, self.message_store, self.transport, self.identity,
20 exchange_store, config)
21 self.pinger = self.pinger_factory(self.reactor, config.ping_url,
22- self.identity, self.exchanger)
23+ self.identity, self.exchanger,
24+ interval=config.ping_interval)
25 self.registration = RegistrationHandler(
26 config, self.identity, self.reactor, self.exchanger, self.pinger,
27 self.message_store, fetch_async)
28
29=== modified file 'landscape/broker/tests/test_config.py'
30--- landscape/broker/tests/test_config.py 2011-07-05 05:09:11 +0000
31+++ landscape/broker/tests/test_config.py 2011-08-19 15:49:30 +0000
32@@ -64,15 +64,17 @@
33
34 def test_intervals_are_ints(self):
35 """
36- The 'urgent_exchange_interval and 'exchange_interval' values specified
37- in the configuration file are converted to integers.
38+ The 'urgent_exchange_interval, 'exchange_interval' and 'ping_interval'
39+ values specified in the configuration file are converted to integers.
40 """
41 filename = self.makeFile("[client]\n"
42 "urgent_exchange_interval = 12\n"
43- "exchange_interval = 34\n")
44+ "exchange_interval = 34\n"
45+ "ping_interval = 6\n")
46
47 configuration = BrokerConfiguration()
48 configuration.load(["--config", filename, "--url", "whatever"])
49
50 self.assertEqual(configuration.urgent_exchange_interval, 12)
51 self.assertEqual(configuration.exchange_interval, 34)
52+ self.assertEqual(configuration.ping_interval, 6)
53
54=== modified file 'landscape/broker/tests/test_service.py'
55--- landscape/broker/tests/test_service.py 2011-07-05 05:09:11 +0000
56+++ landscape/broker/tests/test_service.py 2011-08-19 15:49:30 +0000
57@@ -54,9 +54,14 @@
58
59 def test_pinger(self):
60 """
61- A L{BrokerService} instance has a proper C{pinger} attribute.
62+ A L{BrokerService} instance has a proper C{pinger} attribute. Its
63+ interval value is configured with the C{ping_interval} value.
64 """
65 self.assertEqual(self.service.pinger.get_url(), self.config.ping_url)
66+ self.assertEqual(30, self.service.pinger.get_interval())
67+ self.config.ping_interval = 20
68+ service = BrokerService(self.config)
69+ self.assertEqual(20, service.pinger.get_interval())
70
71 def test_registration(self):
72 """

Subscribers

People subscribed via source and target branches

to all changes: