Merge lp:~tealeg/landscape-client/package-monitor-scoped-resynch into lp:~landscape/landscape-client/trunk

Proposed by Geoff Teale
Status: Superseded
Proposed branch: lp:~tealeg/landscape-client/package-monitor-scoped-resynch
Merge into: lp:~landscape/landscape-client/trunk
Prerequisite: lp:~tealeg/landscape-client/monitoring-plugins-scoped-resynch
Diff against target: 454 lines (+274/-4) (has conflicts)
12 files modified
landscape/monitor/packagemonitor.py (+1/-0)
landscape/monitor/plugin.py (+5/-0)
landscape/monitor/tests/test_aptpreferences.py (+5/-0)
landscape/monitor/tests/test_computerinfo.py (+5/-0)
landscape/monitor/tests/test_mountinfo.py (+5/-0)
landscape/monitor/tests/test_packagemonitor.py (+78/-4)
landscape/monitor/tests/test_plugin.py (+46/-0)
landscape/monitor/tests/test_processorinfo.py (+5/-0)
landscape/monitor/tests/test_rebootrequired.py (+5/-0)
landscape/monitor/tests/test_swiftdeviceinfo.py (+5/-0)
landscape/monitor/tests/test_updatemanager.py (+5/-0)
landscape/monitor/tests/test_usermonitor.py (+109/-0)
Text conflict in landscape/monitor/plugin.py
Text conflict in landscape/monitor/tests/test_aptpreferences.py
Text conflict in landscape/monitor/tests/test_computerinfo.py
Text conflict in landscape/monitor/tests/test_mountinfo.py
Text conflict in landscape/monitor/tests/test_packagemonitor.py
Text conflict in landscape/monitor/tests/test_plugin.py
Text conflict in landscape/monitor/tests/test_processorinfo.py
Text conflict in landscape/monitor/tests/test_rebootrequired.py
Text conflict in landscape/monitor/tests/test_swiftdeviceinfo.py
Text conflict in landscape/monitor/tests/test_updatemanager.py
Text conflict in landscape/monitor/tests/test_usermonitor.py
To merge this branch: bzr merge lp:~tealeg/landscape-client/package-monitor-scoped-resynch
Reviewer Review Type Date Requested Status
Björn Tillenius Pending
Jerry Seutter Pending
Review via email: mp+174373@code.launchpad.net

This proposal supersedes a proposal from 2013-07-05.

This proposal has been superseded by a proposal from 2013-07-16.

Description of the change

This branch makes the PackageMonitor plugin only respond to resynchronize-clients events when they are either "package" or global scope.

To post a comment you must log in.
Revision history for this message
Jerry Seutter (jseutter) wrote : Posted in a previous version of this proposal

+1, looks good.

landscape/monitor/tests/test_packagemonitor.py:233:80: E501 line too long (80 characters)

review: Approve
Revision history for this message
Jerry Seutter (jseutter) wrote : Posted in a previous version of this proposal

In other branches the call signature for _resynchronize uses scopes:
def _resynchronize(self, scopes):

Can you update this changeset to use scopes instead of scope?

Revision history for this message
Geoff Teale (tealeg) wrote : Posted in a previous version of this proposal

> +1, looks good.
>
> landscape/monitor/tests/test_packagemonitor.py:233:80: E501 line too long (80
> characters)

Done.

Revision history for this message
Geoff Teale (tealeg) wrote : Posted in a previous version of this proposal

> In other branches the call signature for _resynchronize uses scopes:
> def _resynchronize(self, scopes):
>
> Can you update this changeset to use scopes instead of scope?

Done.

Revision history for this message
Björn Tillenius (bjornt) wrote : Posted in a previous version of this proposal

[1]

+ if len(scopes) == 0 or self.scope in scopes:

This makes me a bit sad. Having this in every _resynchronize() doesn't
doesn't look good.

I see that we register the resynchronize method with something like
this:

  self.registry.reactor.call_on("resynchronize", self._resynchronize)

I'd suggest doing something like this instead:

  self.registry.register_resynchronize(self.scope, self._resynchronize)

That way self._resynchronize would be called only for the relevant
scope, which makes the method easier to read.

review: Needs Fixing
Revision history for this message
Geoff Teale (tealeg) wrote : Posted in a previous version of this proposal

> [1]
>
> + if len(scopes) == 0 or self.scope in scopes:
>
> This makes me a bit sad. Having this in every _resynchronize() doesn't
> doesn't look good.
>
> I see that we register the resynchronize method with something like
> this:
>
> self.registry.reactor.call_on("resynchronize", self._resynchronize)
>
> I'd suggest doing something like this instead:
>
> self.registry.register_resynchronize(self.scope, self._resynchronize)
>
> That way self._resynchronize would be called only for the relevant
> scope, which makes the method easier to read.

Hi Bjorn, would you be happy for me to make that change as a follow on branch? It effects multiple branches here and it would be cleaner to tidy it all up in one swoop.

Revision history for this message
Björn Tillenius (bjornt) wrote : Posted in a previous version of this proposal

On Wed, Jul 10, 2013 at 05:37:53PM -0000, Geoff Teale wrote:
> > [1]
> >
> > + if len(scopes) == 0 or self.scope in scopes:
> >
> > This makes me a bit sad. Having this in every _resynchronize() doesn't
> > doesn't look good.
> >
> > I see that we register the resynchronize method with something like
> > this:
> >
> > self.registry.reactor.call_on("resynchronize", self._resynchronize)
> >
> > I'd suggest doing something like this instead:
> >
> > self.registry.register_resynchronize(self.scope, self._resynchronize)
> >
> > That way self._resynchronize would be called only for the relevant
> > scope, which makes the method easier to read.
>
> Hi Bjorn, would you be happy for me to make that change as a follow on
> branch? It effects multiple branches here and it would be cleaner to
> tidy it all up in one swoop.

Sure, that would be fine, if it's easier.

Revision history for this message
Geoff Teale (tealeg) wrote : Posted in a previous version of this proposal

> > Hi Bjorn, would you be happy for me to make that change as a follow on
> > branch? It effects multiple branches here and it would be cleaner to
> > tidy it all up in one swoop.
>
> Sure, that would be fine, if it's easier.

OK, I'll add a clean up branch at the end, I have some other calls to tidy up across all branches too.

720. By Geoff Teale

Merge forwards and fix conflicts.

721. By Geoff Teale

Merge forwards

722. By Geoff Teale

merge forwards and resolve conflicts.

723. By Geoff Teale

Make test more readable by returning the task from createReporterTask.

Unmerged revisions

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'landscape/monitor/packagemonitor.py'
2--- landscape/monitor/packagemonitor.py 2013-07-12 08:18:35 +0000
3+++ landscape/monitor/packagemonitor.py 2013-07-16 13:16:33 +0000
4@@ -11,6 +11,7 @@
5 class PackageMonitor(MonitorPlugin):
6
7 run_interval = 1800
8+ scope = "package"
9
10 def __init__(self, package_store_filename=None):
11 super(PackageMonitor, self).__init__()
12
13=== modified file 'landscape/monitor/plugin.py'
14--- landscape/monitor/plugin.py 2013-07-12 14:12:48 +0000
15+++ landscape/monitor/plugin.py 2013-07-16 13:16:33 +0000
16@@ -23,9 +23,14 @@
17 else:
18 self._persist = None
19
20+<<<<<<< TREE
21 def _reset(self):
22 if self.persist_name is not None:
23 self.registry.persist.remove(self.persist_name)
24+=======
25+ def _reset(self):
26+ self.registry.persist.remove(self.persist_name)
27+>>>>>>> MERGE-SOURCE
28
29 @property
30 def persist(self):
31
32=== modified file 'landscape/monitor/tests/test_aptpreferences.py'
33--- landscape/monitor/tests/test_aptpreferences.py 2013-07-12 13:41:07 +0000
34+++ landscape/monitor/tests/test_aptpreferences.py 2013-07-16 13:16:33 +0000
35@@ -171,7 +171,12 @@
36 self.makeFile(path=preferences_filename, content="crap")
37 self.mstore.set_accepted_types(["apt-preferences"])
38 self.plugin.run()
39+<<<<<<< TREE
40 self.reactor.fire("resynchronize", scopes=["package"])
41+=======
42+ package_scope = ["package"]
43+ self.reactor.fire("resynchronize", package_scope)
44+>>>>>>> MERGE-SOURCE
45 self.plugin.run()
46 messages = self.mstore.get_pending_messages()
47 self.assertEqual(len(messages), 2)
48
49=== modified file 'landscape/monitor/tests/test_computerinfo.py'
50--- landscape/monitor/tests/test_computerinfo.py 2013-07-12 13:41:07 +0000
51+++ landscape/monitor/tests/test_computerinfo.py 2013-07-16 13:16:33 +0000
52@@ -278,7 +278,12 @@
53 root_path=self.makeDir())
54 self.monitor.add(plugin)
55 plugin.exchange()
56+<<<<<<< TREE
57 self.reactor.fire("resynchronize", scopes=["computer"])
58+=======
59+ computer_scope = ["computer"]
60+ self.reactor.fire("resynchronize", computer_scope)
61+>>>>>>> MERGE-SOURCE
62 plugin.exchange()
63 computer_info = {"type": "computer-info", "hostname": "ooga.local",
64 "timestamp": 0, "total-memory": 1510,
65
66=== modified file 'landscape/monitor/tests/test_mountinfo.py'
67--- landscape/monitor/tests/test_mountinfo.py 2013-07-12 13:41:07 +0000
68+++ landscape/monitor/tests/test_mountinfo.py 2013-07-16 13:16:33 +0000
69@@ -422,7 +422,12 @@
70
71 plugin.run()
72 plugin.exchange()
73+<<<<<<< TREE
74 self.reactor.fire("resynchronize", scopes=["disk"])
75+=======
76+ disk_scope = ["disk"]
77+ self.reactor.fire("resynchronize", disk_scope)
78+>>>>>>> MERGE-SOURCE
79 plugin.run()
80 plugin.exchange()
81 messages = self.mstore.get_pending_messages()
82
83=== modified file 'landscape/monitor/tests/test_packagemonitor.py'
84--- landscape/monitor/tests/test_packagemonitor.py 2013-07-16 08:30:55 +0000
85+++ landscape/monitor/tests/test_packagemonitor.py 2013-07-16 13:16:33 +0000
86@@ -23,6 +23,33 @@
87
88 self.package_monitor = PackageMonitor(self.package_store_filename)
89
90+ def createReporterTask(self):
91+ """
92+ Put a task for the package reported into the package store.
93+ """
94+ message = {"type": "package-ids", "ids": [None], "request-id": 1}
95+ self.package_store.add_task("reporter", message)
96+
97+ def assertSingleReporterTask(self, data, task_id):
98+ """
99+ Check that we have exactly one task, that it contains the right data
100+ and that it's ID matches our expectation.
101+ """
102+ # The next task should contain the passed data.
103+ task = self.package_store.get_next_task("reporter")
104+ self.assertEqual(task.data, data)
105+
106+ # We want to make sure it has the correct id of 2 so that we
107+ # know it's not a new task that the reporter could possibly
108+ # remove by accident.
109+ self.assertEqual(task.id, task_id)
110+
111+ # Let's remove that task and make sure there are no more tasks
112+ # in the queue.
113+ task.remove()
114+ task = self.package_store.get_next_task("reporter")
115+ self.assertEqual(task, None)
116+
117 def test_create_default_store_upon_message_handling(self):
118 """
119 If the package sqlite database file doesn't exist yet, it is created
120@@ -200,17 +227,46 @@
121
122 def test_resynchronize(self):
123 """
124- If a 'resynchronize' reactor event is fired, the package
125- monitor should clear all queued tasks and queue a task that
126+ If a 'resynchronize' reactor event is fired with 'package' scope, the
127+ package monitor should clear all queued tasks and queue a task that
128 tells the report to clear out the rest of the package data.
129 """
130 self.monitor.add(self.package_monitor)
131- message = {"type": "package-ids", "ids": [None], "request-id": 1}
132- self.package_store.add_task("reporter", message)
133+ self.createReporterTask()
134+
135+ # The server doesn't currently send 'package' scope, but we should
136+ # support it in case we change that in the future.
137+ package_scope = ["package"]
138+ self.monitor.reactor.fire("resynchronize", package_scope)
139+
140+ self.assertSingleReporterTask({"type": "resynchronize"}, 2)
141+
142+ def test_resynchronize_gets_new_session_id(self):
143+ """
144+ When a 'resynchronize' reactor event is fired, the C{PackageMonitor}
145+ acquires a new session ID (as the old one will be blocked).
146+ """
147+ self.monitor.add(self.package_monitor)
148+ session_id = self.package_monitor._session_id
149+ self.createReporterTask()
150+
151+ self.package_monitor.client.broker.message_store.drop_session_ids()
152+ self.monitor.reactor.fire("resynchronize")
153+ self.assertNotEqual(session_id, self.package_monitor._session_id)
154+
155+ def test_resynchronize_on_global_scope(self):
156+ """
157+ If a 'resynchronize' reactor event is fired with global scope (the
158+ empty list) , the package monitor should act as if it were an event
159+ with 'package' scope.
160+ """
161+ self.monitor.add(self.package_monitor)
162+ self.createReporterTask()
163
164 self.monitor.reactor.fire("resynchronize")
165
166 # The next task should be the resynchronize message.
167+<<<<<<< TREE
168 task = self.package_store.get_next_task("reporter")
169 self.assertEqual(task.data, {"type": "resynchronize"})
170
171@@ -222,6 +278,24 @@
172 task.remove()
173 task = self.package_store.get_next_task("reporter")
174 self.assertEqual(task, None)
175+=======
176+ self.assertSingleReporterTask({"type": "resynchronize"}, 2)
177+
178+ def test_not_resynchronize_with_other_scope(self):
179+ """
180+ If a 'resynchronize' reactor event is fired with an irrelevant scope,
181+ the package monitor should not respond to this.
182+ """
183+ self.monitor.add(self.package_monitor)
184+ self.createReporterTask()
185+
186+ disk_scope = ["disk"]
187+ self.monitor.reactor.fire("resynchronize", disk_scope)
188+
189+ # The next task should *not* be the resynchronize message.
190+ self.assertSingleReporterTask(
191+ {'ids': [None], 'request-id': 1, 'type': 'package-ids'}, 1)
192+>>>>>>> MERGE-SOURCE
193
194 def test_spawn_reporter_doesnt_chdir(self):
195 command = self.makeFile("#!/bin/sh\necho RUN\n")
196
197=== modified file 'landscape/monitor/tests/test_plugin.py'
198--- landscape/monitor/tests/test_plugin.py 2013-07-12 13:41:07 +0000
199+++ landscape/monitor/tests/test_plugin.py 2013-07-16 13:16:33 +0000
200@@ -65,6 +65,7 @@
201 plugin.call_on_accepted("type", callback)
202 self.reactor.fire(("message-type-acceptance-changed", "type"), False)
203
204+<<<<<<< TREE
205 def test_resynchronize_with_global_scope(self):
206 """
207 If a 'resynchronize' event fires with global scope, we clear down the
208@@ -106,6 +107,51 @@
209 self.reactor.fire("resynchronize", scopes=["chrutfup"])
210 self.assertEqual(self.monitor.persist.get("wubble"), {"hi": "there"})
211
212+=======
213+ def test_resynchronize_with_global_scope(self):
214+ """
215+ If a 'resynchronize' event fires with global scope, we clear down the
216+ persist.
217+ """
218+ plugin = MonitorPlugin()
219+ plugin.persist_name = "wubble"
220+ plugin.register(self.monitor)
221+ plugin.persist.set("hi", "there")
222+ self.assertEqual(self.monitor.persist.get("wubble"), {"hi": "there"})
223+ self.reactor.fire("resynchronize")
224+ self.assertIsNone(self.monitor.persist.get("wubble"))
225+
226+ def test_resynchronize_with_provided_scope(self):
227+ """
228+ If a 'resynchronize' event fires with the provided scope, we clear down
229+ the persist.
230+ """
231+ plugin = MonitorPlugin()
232+ plugin.persist_name = "wubble"
233+ plugin.scope = "frujical"
234+ plugin.register(self.monitor)
235+ plugin.persist.set("hi", "there")
236+ self.assertEqual(self.monitor.persist.get("wubble"), {"hi": "there"})
237+ frujical_scope = ["frujical"]
238+ self.reactor.fire("resynchronize", frujical_scope)
239+ self.assertIsNone(self.monitor.persist.get("wubble"))
240+
241+ def test_do_not_resynchronize_with_other_scope(self):
242+ """
243+ If a 'resynchronize' event fires with an irrelevant scope, we do
244+ nothing.
245+ """
246+ plugin = MonitorPlugin()
247+ plugin.persist_name = "wubble"
248+ plugin.scope = "frujical"
249+ plugin.register(self.monitor)
250+ plugin.persist.set("hi", "there")
251+ self.assertEqual(self.monitor.persist.get("wubble"), {"hi": "there"})
252+ chrutfup_scope = ["chrutfup"]
253+ self.reactor.fire("resynchronize", chrutfup_scope)
254+ self.assertEqual(self.monitor.persist.get("wubble"), {"hi": "there"})
255+
256+>>>>>>> MERGE-SOURCE
257
258 class StubDataWatchingPlugin(DataWatcher):
259
260
261=== modified file 'landscape/monitor/tests/test_processorinfo.py'
262--- landscape/monitor/tests/test_processorinfo.py 2013-07-12 13:41:07 +0000
263+++ landscape/monitor/tests/test_processorinfo.py 2013-07-16 13:16:33 +0000
264@@ -53,7 +53,12 @@
265 plugin = ProcessorInfo()
266 self.monitor.add(plugin)
267 plugin.run()
268+<<<<<<< TREE
269 self.reactor.fire("resynchronize", scopes=["cpu"])
270+=======
271+ cpu_scope = ["cpu"]
272+ self.reactor.fire("resynchronize", cpu_scope)
273+>>>>>>> MERGE-SOURCE
274 plugin.run()
275 messages = self.mstore.get_pending_messages()
276 self.assertEqual(len(messages), 2)
277
278=== modified file 'landscape/monitor/tests/test_rebootrequired.py'
279--- landscape/monitor/tests/test_rebootrequired.py 2013-07-12 13:41:07 +0000
280+++ landscape/monitor/tests/test_rebootrequired.py 2013-07-16 13:16:33 +0000
281@@ -117,7 +117,12 @@
282 data.
283 """
284 self.plugin.run()
285+<<<<<<< TREE
286 self.reactor.fire("resynchronize", scopes=["package"])
287+=======
288+ package_scope = ["package"]
289+ self.reactor.fire("resynchronize", package_scope)
290+>>>>>>> MERGE-SOURCE
291 self.plugin.run()
292 messages = self.mstore.get_pending_messages()
293 self.assertEqual(len(messages), 2)
294
295=== modified file 'landscape/monitor/tests/test_swiftdeviceinfo.py'
296--- landscape/monitor/tests/test_swiftdeviceinfo.py 2013-07-12 13:41:07 +0000
297+++ landscape/monitor/tests/test_swiftdeviceinfo.py 2013-07-16 13:16:33 +0000
298@@ -136,7 +136,12 @@
299
300 plugin.run()
301 plugin.exchange()
302+<<<<<<< TREE
303 self.reactor.fire("resynchronize", scopes=["storage"])
304+=======
305+ storage_scope = ["storage"]
306+ self.reactor.fire("resynchronize", storage_scope)
307+>>>>>>> MERGE-SOURCE
308 plugin.run()
309 plugin.exchange()
310 messages = self.mstore.get_pending_messages()
311
312=== modified file 'landscape/monitor/tests/test_updatemanager.py'
313--- landscape/monitor/tests/test_updatemanager.py 2013-07-12 13:41:07 +0000
314+++ landscape/monitor/tests/test_updatemanager.py 2013-07-16 13:16:33 +0000
315@@ -103,7 +103,12 @@
316 data.
317 """
318 self.plugin.run()
319+<<<<<<< TREE
320 self.reactor.fire("resynchronize", scopes=["package"])
321+=======
322+ package_scope = ["package"]
323+ self.reactor.fire("resynchronize", package_scope)
324+>>>>>>> MERGE-SOURCE
325 self.plugin.run()
326 messages = self.mstore.get_pending_messages()
327 self.assertEqual(len(messages), 2)
328
329=== modified file 'landscape/monitor/tests/test_usermonitor.py'
330--- landscape/monitor/tests/test_usermonitor.py 2013-07-16 09:01:54 +0000
331+++ landscape/monitor/tests/test_usermonitor.py 2013-07-16 13:16:33 +0000
332@@ -76,6 +76,7 @@
333
334 def test_wb_resynchronize_event(self):
335 """
336+<<<<<<< TREE
337 When a C{resynchronize} event, with 'users' scope, occurs any cached
338 L{UserChange} snapshots should be cleared and a new message with users
339 generated.
340@@ -219,6 +220,114 @@
341 # "work-phone": None}],
342 # "type": "users"}])
343 # >>>>>>> MERGE-SOURCE
344+=======
345+ When a C{resynchronize} event occurs any cached L{UserChange}
346+ snapshots should be cleared and a new message with users generated.
347+ """
348+ self.provider.users = [("jdoe", "x", 1000, 1000, "JD,,,,",
349+ "/home/jdoe", "/bin/sh")]
350+ self.provider.groups = [("webdev", "x", 1000, ["jdoe"])]
351+ self.broker_service.message_store.set_accepted_types(["users"])
352+ self.monitor.add(self.plugin)
353+ self.successResultOf(self.plugin.run())
354+
355+ persist = self.plugin._persist
356+ self.assertTrue(persist.get("users"))
357+ self.assertTrue(persist.get("groups"))
358+ self.assertMessages(
359+ self.broker_service.message_store.get_pending_messages(),
360+ [{"create-group-members": {u"webdev":[u"jdoe"]},
361+ "create-groups": [{"gid": 1000, "name": u"webdev"}],
362+ "create-users": [{"enabled": True, "home-phone": None,
363+ "location": None, "name": u"JD",
364+ "primary-gid": 1000, "uid": 1000,
365+ "username": u"jdoe", "work-phone": None}],
366+ "type": "users"}])
367+
368+ # Clear all the messages from the message store
369+ self.broker_service.message_store.delete_all_messages()
370+
371+ self.monitor.reactor.fire("resynchronize")
372+
373+ self.successResultOf(self.plugin.run())
374+ self.assertMessages(
375+ self.broker_service.message_store.get_pending_messages(),
376+ [{"create-group-members": {u"webdev":[u"jdoe"]},
377+ "create-groups": [{"gid": 1000, "name": u"webdev"}],
378+ "create-users": [{"enabled": True, "home-phone": None,
379+ "location": None, "name": u"JD",
380+ "primary-gid": 1000, "uid": 1000,
381+ "username": u"jdoe",
382+ "work-phone": None}],
383+ "type": "users"}])
384+
385+ def test_wb_resynchronize_event_with_global_scope(self):
386+ """
387+ When a C{resynchronize} event, with global scope, occurs we act exactly
388+ as if it had 'users' scope.
389+ """
390+ self.provider.users = [("jdoe", "x", 1000, 1000, "JD,,,,",
391+ "/home/jdoe", "/bin/sh")]
392+ self.provider.groups = [("webdev", "x", 1000, ["jdoe"])]
393+ self.broker_service.message_store.set_accepted_types(["users"])
394+ self.monitor.add(self.plugin)
395+ self.successResultOf(self.plugin.run())
396+ persist = self.plugin._persist
397+ self.assertTrue(persist.get("users"))
398+ self.assertTrue(persist.get("groups"))
399+ self.assertMessages(
400+ self.broker_service.message_store.get_pending_messages(),
401+ [{"create-group-members": {u"webdev":[u"jdoe"]},
402+ "create-groups": [{"gid": 1000, "name": u"webdev"}],
403+ "create-users": [{"enabled": True, "home-phone": None,
404+ "location": None, "name": u"JD",
405+ "primary-gid": 1000, "uid": 1000,
406+ "username": u"jdoe", "work-phone": None}],
407+ "type": "users"}])
408+ self.broker_service.message_store.delete_all_messages()
409+ deferred = self.monitor.reactor.fire("resynchronize")[0]
410+ self.successResultOf(deferred)
411+ self.assertMessages(
412+ self.broker_service.message_store.get_pending_messages(),
413+ [{"create-group-members": {u"webdev":[u"jdoe"]},
414+ "create-groups": [{"gid": 1000, "name": u"webdev"}],
415+ "create-users": [{"enabled": True, "home-phone": None,
416+ "location": None, "name": u"JD",
417+ "primary-gid": 1000, "uid": 1000,
418+ "username": u"jdoe",
419+ "work-phone": None}],
420+ "type": "users"}])
421+
422+ def test_do_not_resynchronize_with_other_scope(self):
423+ """
424+ When a C{resynchronize} event, with an irrelevant scope, occurs we do
425+ nothing.
426+ """
427+ self.provider.users = [("jdoe", "x", 1000, 1000, "JD,,,,",
428+ "/home/jdoe", "/bin/sh")]
429+ self.provider.groups = [("webdev", "x", 1000, ["jdoe"])]
430+ self.broker_service.message_store.set_accepted_types(["users"])
431+ self.monitor.add(self.plugin)
432+ self.successResultOf(self.plugin.run())
433+ persist = self.plugin._persist
434+ self.assertTrue(persist.get("users"))
435+ self.assertTrue(persist.get("groups"))
436+ self.assertMessages(
437+ self.broker_service.message_store.get_pending_messages(),
438+ [{"create-group-members": {u"webdev":[u"jdoe"]},
439+ "create-groups": [{"gid": 1000, "name": u"webdev"}],
440+ "create-users": [{"enabled": True, "home-phone": None,
441+ "location": None, "name": u"JD",
442+ "primary-gid": 1000, "uid": 1000,
443+ "username": u"jdoe", "work-phone": None}],
444+ "type": "users"}])
445+ self.broker_service.message_store.delete_all_messages()
446+ disk_scope = ["disk"]
447+ self.monitor.reactor.fire("resynchronize", disk_scope)[0]
448+ self.assertMessages(
449+ self.broker_service.message_store.get_pending_messages(),
450+ [])
451+>>>>>>> MERGE-SOURCE
452
453 def test_run(self):
454 """

Subscribers

People subscribed via source and target branches

to all changes: