Merge lp:~free.ekanayaka/landscape-client/juju-machine-registration into lp:~landscape/landscape-client/trunk

Proposed by Free Ekanayaka on 2014-08-28
Status: Merged
Approved by: Free Ekanayaka on 2014-09-02
Approved revision: 789
Merged at revision: 784
Proposed branch: lp:~free.ekanayaka/landscape-client/juju-machine-registration
Merge into: lp:~landscape/landscape-client/trunk
Diff against target: 476 lines (+105/-71)
9 files modified
landscape/__init__.py (+3/-1)
landscape/broker/registration.py (+16/-7)
landscape/broker/tests/test_exchange.py (+4/-4)
landscape/broker/tests/test_registration.py (+38/-18)
landscape/broker/tests/test_store.py (+3/-4)
landscape/manager/tests/test_customgraph.py (+8/-10)
landscape/manager/tests/test_shutdownmanager.py (+2/-3)
landscape/message_schemas.py (+29/-21)
landscape/monitor/tests/test_activeprocessinfo.py (+2/-3)
To merge this branch: bzr merge lp:~free.ekanayaka/landscape-client/juju-machine-registration
Reviewer Review Type Date Requested Status
Adam Collard (community) 2014-08-28 Approve on 2014-09-01
Alberto Donato 2014-08-28 Approve on 2014-08-29
Review via email: mp+232531@code.launchpad.net

Commit message

This branch:

- Bumps the server API to 3.3: this will let us introduce a new schema
  for the juju-info registration field, since we have released clients
  out there that could potentially send the old juju-info schema (although
  they'd need to be deployed with an older version of the client charm,
  so it's more a theoretical situation than one that can happen in practice).
  A server branch has been pushed to bump the server to API 3.3. as well.

- Include the machine ID information in the registration message if the server
  is capable of handling it.

Description of the change

This branch:

- Bumps the server API to 3.3: this will let us introduce a new schema for the juju-info registration field, since we have released clients out there that could potentially send the old juju-info schema (although they'd need to be deployed with an older version of the client charm, so it's more a theoretical situation than one that can happen in practice). A server branch has been pushed to bump the server to API 3.3. as well. See:

https://code.launchpad.net/~free.ekanayaka/landscape/handle-machine-id-registration/+merge/232535

- Include the machine ID information in the registration message if the server is capable of handling it.

Just to be clear, after the server-side branch lands too what happen will be that new clients will send a 3.3 registration message with the new juju info schema, which the server knows how to handle. In case old clients send the old juju-info field, the server will just ignore it.

To post a comment you must log in.
Alberto Donato (ack) wrote :

Looks good, +1

A few comments inline.

review: Approve
Free Ekanayaka (free.ekanayaka) wrote :

Thanks Albert, all fixed.

788. By Free Ekanayaka on 2014-08-29

Address review comments

Adam Collard (adam-collard) wrote :

Lint issue:

landscape/monitor/tests/test_activeprocessinfo.py:13: 'SERVER_API' imported but unused

Adam Collard (adam-collard) wrote :

Needs Fixing because there are several changes needed and I'd like to give it another pass.

7 inline comments for your perusal below!

review: Needs Fixing
Free Ekanayaka (free.ekanayaka) wrote :

Thanks Adam, should be all fixed/replied.

789. By Free Ekanayaka on 2014-09-01

Address review comments

Adam Collard (adam-collard) wrote :

LGTM! +1

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'landscape/__init__.py'
--- landscape/__init__.py 2014-07-16 17:15:13 +0000
+++ landscape/__init__.py 2014-09-01 13:16:19 +0000
@@ -13,10 +13,12 @@
13#13#
14# Changelog:14# Changelog:
15#15#
16# 3.3:
17# * Add new schema for the "registration" message, providing Juju information
16# 3.2:18# 3.2:
17# * Add new "eucalyptus-info" and "eucalyptus-info-error" messages.19# * Add new "eucalyptus-info" and "eucalyptus-info-error" messages.
18#20#
19SERVER_API = "3.2"21SERVER_API = "3.3"
2022
21# XXX This is needed for backward compatibility in the server code importing23# XXX This is needed for backward compatibility in the server code importing
22# the API variable. We should eventually replace it in the server code.24# the API variable. We should eventually replace it in the server code.
2325
=== modified file 'landscape/broker/registration.py'
--- landscape/broker/registration.py 2014-08-22 14:00:17 +0000
+++ landscape/broker/registration.py 2014-09-01 13:16:19 +0000
@@ -16,6 +16,7 @@
16from landscape.lib.tag import is_valid_tag_list16from landscape.lib.tag import is_valid_tag_list
17from landscape.lib.network import get_fqdn17from landscape.lib.network import get_fqdn
18from landscape.lib.vm_info import get_vm_info, get_container_info18from landscape.lib.vm_info import get_vm_info, get_container_info
19from landscape.lib.versioning import is_version_higher
1920
2021
21class InvalidCredentialsError(Exception):22class InvalidCredentialsError(Exception):
@@ -126,10 +127,10 @@
126127
127 def _get_juju_data(self):128 def _get_juju_data(self):
128 """Load Juju information."""129 """Load Juju information."""
129 juju_info = get_juju_info(self._config)[0]130 juju_info = get_juju_info(self._config)
130 if juju_info is None:131 if juju_info is None:
131 return None132 return None
132 self._juju_data = juju_info # A list of dicts133 self._juju_data = juju_info # (list of dicts, new juju info struct)
133134
134 def _handle_exchange_done(self):135 def _handle_exchange_done(self):
135 """Registered handler for the C{"exchange-done"} event.136 """Registered handler for the C{"exchange-done"} event.
@@ -188,11 +189,19 @@
188 if group:189 if group:
189 message["access_group"] = group190 message["access_group"] = group
190191
191 if self._juju_data is not None:192 server_api = self._message_store.get_server_api()
192 # For backwards compatibility, set the juju-info to be one of193 # If we have juju data to send and if the server is recent enough to
193 # the juju infos (it used not to be a list).194 # know how to handle juju data, then we include it in the registration
194 message["juju-info"] = self._juju_data[0]195 # message. We want to trigger the 3.3 server handler because client
195 message["juju-info-list"] = self._juju_data196 # version 14.01 has a different format for the juju-info field,
197 # so this makes sure that the correct schema is used by the server
198 # when validating our message.
199 if self._juju_data and is_version_higher(server_api, "3.3"):
200 juju_info_list, juju_info = self._juju_data
201 message["juju-info"] = juju_info
202 # XXX the juju-info-list field will be dropped once the migration
203 # to computer-machine association is complete
204 message["juju-info-list"] = juju_info_list
196205
197 # The computer is a normal computer, possibly a container.206 # The computer is a normal computer, possibly a container.
198 with_word = "with" if bool(registration_key) else "without"207 with_word = "with" if bool(registration_key) else "without"
199208
=== modified file 'landscape/broker/tests/test_exchange.py'
--- landscape/broker/tests/test_exchange.py 2014-08-22 13:53:51 +0000
+++ landscape/broker/tests/test_exchange.py 2014-09-01 13:16:19 +0000
@@ -1,4 +1,4 @@
1from landscape import SERVER_API, CLIENT_API1from landscape import CLIENT_API
2from landscape.lib.persist import Persist2from landscape.lib.persist import Persist
3from landscape.lib.hashlib import md53from landscape.lib.hashlib import md5
4from landscape.schema import Message, Int4from landscape.schema import Message, Int
@@ -111,7 +111,7 @@
111 messages = self.transport.payloads[0]["messages"]111 messages = self.transport.payloads[0]["messages"]
112 self.assertEqual(messages, [{"type": "empty",112 self.assertEqual(messages, [{"type": "empty",
113 "timestamp": 0,113 "timestamp": 0,
114 "api": SERVER_API}])114 "api": "3.2"}])
115115
116 def test_send_urgent(self):116 def test_send_urgent(self):
117 """117 """
@@ -528,8 +528,8 @@
528 payload = self.transport.payloads[-1]528 payload = self.transport.payloads[-1]
529 self.assertMessages(payload["messages"], [])529 self.assertMessages(payload["messages"], [])
530 self.assertEqual(payload.get("client-api"), CLIENT_API)530 self.assertEqual(payload.get("client-api"), CLIENT_API)
531 self.assertEqual(payload.get("server-api"), SERVER_API)531 self.assertEqual(payload.get("server-api"), "3.2")
532 self.assertEqual(self.transport.message_api, SERVER_API)532 self.assertEqual(self.transport.message_api, "3.2")
533533
534 self.mstore.add({"type": "a", "api": "1.0"})534 self.mstore.add({"type": "a", "api": "1.0"})
535 self.mstore.add({"type": "b", "api": "1.0"})535 self.mstore.add({"type": "b", "api": "1.0"})
536536
=== modified file 'landscape/broker/tests/test_registration.py'
--- landscape/broker/tests/test_registration.py 2014-08-28 07:36:58 +0000
+++ landscape/broker/tests/test_registration.py 2014-09-01 13:16:19 +0000
@@ -498,15 +498,36 @@
498class JujuRegistrationHandlerTest(RegistrationHandlerTestBase):498class JujuRegistrationHandlerTest(RegistrationHandlerTestBase):
499499
500 juju_contents = json.dumps({"environment-uuid": "DEAD-BEEF",500 juju_contents = json.dumps({"environment-uuid": "DEAD-BEEF",
501 "machine-id": "1",
501 "unit-name": "service/0",502 "unit-name": "service/0",
502 "api-addresses": "10.0.3.1:17070"})503 "api-addresses": "10.0.3.1:17070"})
503504
504 def test_juju_information_added_when_present(self):505 def test_juju_info_added_when_present(self):
506 """
507 When information about the Juju environment is found in
508 the $data_dir/juju-info.d/ directory, it's included in
509 the registration message.
510 """
511 self.mstore.set_accepted_types(["register"])
512 self.mstore.set_server_api("3.3")
513 self.config.account_name = "account_name"
514 self.reactor.fire("run")
515 self.reactor.fire("pre-exchange")
516
517 messages = self.mstore.get_pending_messages()
518 self.assertEqual(
519 {"environment-uuid": "DEAD-BEEF",
520 "machine-id": "1",
521 "api-addresses": ["10.0.3.1:17070"]},
522 messages[0]["juju-info"])
523
524 def test_juju_info_list_added_when_present(self):
505 """525 """
506 When Juju information is found in $data_dir/juju-info.d/*.json,526 When Juju information is found in $data_dir/juju-info.d/*.json,
507 key parts of it are sent in the registration message.527 key parts of it are sent in the registration message.
508 """528 """
509 self.mstore.set_accepted_types(["register"])529 self.mstore.set_accepted_types(["register"])
530 self.mstore.set_server_api("3.3")
510 self.config.account_name = "account_name"531 self.config.account_name = "account_name"
511 self.reactor.fire("run")532 self.reactor.fire("run")
512 self.reactor.fire("pre-exchange")533 self.reactor.fire("pre-exchange")
@@ -517,23 +538,6 @@
517 "unit-name": "service/0"}538 "unit-name": "service/0"}
518 self.assertEqual(expected, messages[0]["juju-info-list"][0])539 self.assertEqual(expected, messages[0]["juju-info-list"][0])
519540
520 def test_juju_info_compatibility_present(self):
521 """
522 When Juju information is found in $data_dir/juju-info.d/*.json,
523 the registration message also contains a "juju-info" key for
524 backwards compatibility with older servers.
525 """
526 self.mstore.set_accepted_types(["register"])
527 self.config.account_name = "account_name"
528 self.reactor.fire("run")
529 self.reactor.fire("pre-exchange")
530
531 messages = self.mstore.get_pending_messages()
532 expected = {"environment-uuid": "DEAD-BEEF",
533 "api-addresses": ["10.0.3.1:17070"],
534 "unit-name": "service/0"}
535 self.assertEqual(expected, messages[0]["juju-info"])
536
537 def test_multiple_juju_information_added_when_present(self):541 def test_multiple_juju_information_added_when_present(self):
538 """542 """
539 When Juju information is found in $data_dir/juju-info.json,543 When Juju information is found in $data_dir/juju-info.json,
@@ -541,6 +545,7 @@
541 """545 """
542 # Write a second file in the config directory546 # Write a second file in the config directory
543 contents = json.dumps({"environment-uuid": "DEAD-BEEF",547 contents = json.dumps({"environment-uuid": "DEAD-BEEF",
548 "machine-id": "1",
544 "unit-name": "service-2/0",549 "unit-name": "service-2/0",
545 "api-addresses": "10.0.3.2:17070",550 "api-addresses": "10.0.3.2:17070",
546 "private-address": "127.0.0.1"})551 "private-address": "127.0.0.1"})
@@ -549,6 +554,7 @@
549 dirname=self.config.juju_directory, suffix=".json")554 dirname=self.config.juju_directory, suffix=".json")
550555
551 self.mstore.set_accepted_types(["register"])556 self.mstore.set_accepted_types(["register"])
557 self.mstore.set_server_api("3.3")
552 self.config.account_name = "account_name"558 self.config.account_name = "account_name"
553 self.reactor.fire("run")559 self.reactor.fire("run")
554 self.reactor.fire("pre-exchange")560 self.reactor.fire("pre-exchange")
@@ -567,3 +573,17 @@
567 "unit-name": "service-2/0",573 "unit-name": "service-2/0",
568 "private-address": "127.0.0.1"}574 "private-address": "127.0.0.1"}
569 self.assertIn(expected2, juju_info)575 self.assertIn(expected2, juju_info)
576
577 def test_juju_info_skipped_with_old_server(self):
578 """
579 If a server doesn't speak at least 3.3, the juju-info field is
580 isn't included in the message.
581 """
582 self.mstore.set_accepted_types(["register"])
583 self.mstore.set_server_api("3.2")
584 self.config.account_name = "account_name"
585 self.reactor.fire("run")
586 self.reactor.fire("pre-exchange")
587
588 messages = self.mstore.get_pending_messages()
589 self.assertNotIn("juju-info", messages[0])
570590
=== modified file 'landscape/broker/tests/test_store.py'
--- landscape/broker/tests/test_store.py 2014-08-21 09:43:26 +0000
+++ landscape/broker/tests/test_store.py 2014-09-01 13:16:19 +0000
@@ -8,7 +8,6 @@
88
9from landscape.tests.helpers import LandscapeTest9from landscape.tests.helpers import LandscapeTest
10from landscape.tests.mocker import ANY10from landscape.tests.mocker import ANY
11from landscape import SERVER_API
1211
1312
14class MessageStoreTest(LandscapeTest):13class MessageStoreTest(LandscapeTest):
@@ -133,7 +132,7 @@
133 self.assertMessages(messages,132 self.assertMessages(messages,
134 [{"type": "data",133 [{"type": "data",
135 "data": "A thing",134 "data": "A thing",
136 "api": SERVER_API}])135 "api": "3.2"}])
137136
138 def test_max_pending(self):137 def test_max_pending(self):
139 for i in range(10):138 for i in range(10):
@@ -271,7 +270,7 @@
271 messages = self.store.get_pending_messages()270 messages = self.store.get_pending_messages()
272271
273 self.assertEqual(messages, [{"type": "data", "data": "2",272 self.assertEqual(messages, [{"type": "data", "data": "2",
274 "api": SERVER_API}])273 "api": "3.2"}])
275274
276 self.store.set_pending_offset(len(messages))275 self.store.set_pending_offset(len(messages))
277276
@@ -302,7 +301,7 @@
302 self.mocker.verify()301 self.mocker.verify()
303 self.mocker.reset()302 self.mocker.reset()
304 self.assertEqual(self.store.get_pending_messages(),303 self.assertEqual(self.store.get_pending_messages(),
305 [{"type": "data", "data": 1, "api": SERVER_API}])304 [{"type": "data", "data": 1, "api": "3.2"}])
306305
307 def test_get_server_api_default(self):306 def test_get_server_api_default(self):
308 """307 """
309308
=== modified file 'landscape/manager/tests/test_customgraph.py'
--- landscape/manager/tests/test_customgraph.py 2011-07-05 05:09:11 +0000
+++ landscape/manager/tests/test_customgraph.py 2014-09-01 13:16:19 +0000
@@ -5,8 +5,6 @@
5from twisted.internet.error import ProcessDone5from twisted.internet.error import ProcessDone
6from twisted.python.failure import Failure6from twisted.python.failure import Failure
77
8from landscape import SERVER_API
9
10from landscape.manager.customgraph import CustomGraphPlugin8from landscape.manager.customgraph import CustomGraphPlugin
11from landscape.manager.store import ManagerStore9from landscape.manager.store import ManagerStore
1210
@@ -458,7 +456,7 @@
458 self.graph_manager.exchange()456 self.graph_manager.exchange()
459 self.assertMessages(457 self.assertMessages(
460 self.broker_service.message_store.get_pending_messages(),458 self.broker_service.message_store.get_pending_messages(),
461 [{"api": SERVER_API,459 [{"api": "3.2",
462 "data": {123: {"error": u"",460 "data": {123: {"error": u"",
463 "script-hash": "e00a2f44dbc7b6710ce32af2348aec9b",461 "script-hash": "e00a2f44dbc7b6710ce32af2348aec9b",
464 "values": []}},462 "values": []}},
@@ -481,7 +479,7 @@
481 self.graph_manager.exchange()479 self.graph_manager.exchange()
482 self.assertMessages(480 self.assertMessages(
483 self.broker_service.message_store.get_pending_messages(),481 self.broker_service.message_store.get_pending_messages(),
484 [{"api": SERVER_API,482 [{"api": "3.2",
485 "data": {},483 "data": {},
486 "timestamp": 0,484 "timestamp": 0,
487 "type": "custom-graph"}])485 "type": "custom-graph"}])
@@ -506,13 +504,13 @@
506 self.graph_manager.exchange()504 self.graph_manager.exchange()
507 self.assertMessages(505 self.assertMessages(
508 self.broker_service.message_store.get_pending_messages(),506 self.broker_service.message_store.get_pending_messages(),
509 [{"api": SERVER_API,507 [{"api": "3.2",
510 "data": {123: {"error": u"",508 "data": {123: {"error": u"",
511 "script-hash": "e00a2f44dbc7b6710ce32af2348aec9b",509 "script-hash": "e00a2f44dbc7b6710ce32af2348aec9b",
512 "values": []}},510 "values": []}},
513 "timestamp": 0,511 "timestamp": 0,
514 "type": "custom-graph"},512 "type": "custom-graph"},
515 {"api": SERVER_API,513 {"api": "3.2",
516 "data": {123: {"error": u"",514 "data": {123: {"error": u"",
517 "script-hash": "e00a2f44dbc7b6710ce32af2348aec9b",515 "script-hash": "e00a2f44dbc7b6710ce32af2348aec9b",
518 "values": []}},516 "values": []}},
@@ -540,13 +538,13 @@
540 self.graph_manager.exchange()538 self.graph_manager.exchange()
541 self.assertMessages(539 self.assertMessages(
542 self.broker_service.message_store.get_pending_messages(),540 self.broker_service.message_store.get_pending_messages(),
543 [{"api": SERVER_API,541 [{"api": "3.2",
544 "data": {123: {"error": u"",542 "data": {123: {"error": u"",
545 "script-hash": "e00a2f44dbc7b6710ce32af2348aec9b",543 "script-hash": "e00a2f44dbc7b6710ce32af2348aec9b",
546 "values": []}},544 "values": []}},
547 "timestamp": 0,545 "timestamp": 0,
548 "type": "custom-graph"},546 "type": "custom-graph"},
549 {"api": SERVER_API,547 {"api": "3.2",
550 "data": {123: {"error": u"",548 "data": {123: {"error": u"",
551 "script-hash": "d483816dc0fbb51ede42502a709b0e2a",549 "script-hash": "d483816dc0fbb51ede42502a709b0e2a",
552 "values": []}},550 "values": []}},
@@ -589,7 +587,7 @@
589 self.graph_manager.exchange()587 self.graph_manager.exchange()
590 self.assertMessages(588 self.assertMessages(
591 self.broker_service.message_store.get_pending_messages(),589 self.broker_service.message_store.get_pending_messages(),
592 [{"api": SERVER_API,590 [{"api": "3.2",
593 "data": {123: {"error": u"",591 "data": {123: {"error": u"",
594 "script-hash":592 "script-hash":
595 "991e15a81929c79fe1d243b2afd99c62",593 "991e15a81929c79fe1d243b2afd99c62",
@@ -631,7 +629,7 @@
631 self.graph_manager.exchange()629 self.graph_manager.exchange()
632 self.assertMessages(630 self.assertMessages(
633 self.broker_service.message_store.get_pending_messages(),631 self.broker_service.message_store.get_pending_messages(),
634 [{"api": SERVER_API, "data": {}, "timestamp": 0, "type":632 [{"api": "3.2", "data": {}, "timestamp": 0, "type":
635 "custom-graph"}])633 "custom-graph"}])
636 return result.addCallback(check)634 return result.addCallback(check)
637635
638636
=== modified file 'landscape/manager/tests/test_shutdownmanager.py'
--- landscape/manager/tests/test_shutdownmanager.py 2013-03-21 14:02:06 +0000
+++ landscape/manager/tests/test_shutdownmanager.py 2014-09-01 13:16:19 +0000
@@ -1,7 +1,6 @@
1from twisted.python.failure import Failure1from twisted.python.failure import Failure
2from twisted.internet.error import ProcessTerminated, ProcessDone2from twisted.internet.error import ProcessTerminated, ProcessDone
33
4from landscape import SERVER_API
5from landscape.manager.plugin import SUCCEEDED, FAILED4from landscape.manager.plugin import SUCCEEDED, FAILED
6from landscape.manager.shutdownmanager import (5from landscape.manager.shutdownmanager import (
7 ShutdownManager, ShutdownProcessProtocol)6 ShutdownManager, ShutdownProcessProtocol)
@@ -44,7 +43,7 @@
44 self.assertTrue(self.broker_service.exchanger.is_urgent())43 self.assertTrue(self.broker_service.exchanger.is_urgent())
45 self.assertEqual(44 self.assertEqual(
46 self.broker_service.message_store.get_pending_messages(),45 self.broker_service.message_store.get_pending_messages(),
47 [{"type": "operation-result", "api": SERVER_API,46 [{"type": "operation-result", "api": "3.2",
48 "operation-id": 100, "timestamp": 10, "status": SUCCEEDED,47 "operation-id": 100, "timestamp": 10, "status": SUCCEEDED,
49 "result-text": u"Data may arrive in batches."}])48 "result-text": u"Data may arrive in batches."}])
5049
@@ -84,7 +83,7 @@
84 self.assertTrue(self.broker_service.exchanger.is_urgent())83 self.assertTrue(self.broker_service.exchanger.is_urgent())
85 self.assertEqual(84 self.assertEqual(
86 self.broker_service.message_store.get_pending_messages(),85 self.broker_service.message_store.get_pending_messages(),
87 [{"type": "operation-result", "api": SERVER_API,86 [{"type": "operation-result", "api": "3.2",
88 "operation-id": 100, "timestamp": 0, "status": FAILED,87 "operation-id": 100, "timestamp": 0, "status": FAILED,
89 "result-text": u"Failure text is reported."}])88 "result-text": u"Failure text is reported."}])
9089
9190
=== modified file 'landscape/message_schemas.py'
--- landscape/message_schemas.py 2014-08-21 09:43:26 +0000
+++ landscape/message_schemas.py 2014-09-01 13:16:19 +0000
@@ -54,14 +54,6 @@
54 "result-text": Unicode()},54 "result-text": Unicode()},
55 optional=["result-code", "result-text"])55 optional=["result-code", "result-text"])
5656
57#ACTION_INFO is obsolete.
58ACTION_INFO = Message(
59 "action-info",
60 {"response-id": Int(),
61 "success": Bool(),
62 "kind": Bytes(),
63 "parameters": Bytes()})
64
65COMPUTER_INFO = Message(57COMPUTER_INFO = Message(
66 "computer-info",58 "computer-info",
67 {"hostname": Unicode(),59 {"hostname": Unicode(),
@@ -112,11 +104,7 @@
112 "unit-name": Unicode(),104 "unit-name": Unicode(),
113 "private-address": Unicode()}105 "private-address": Unicode()}
114106
115# The copy is needed because Message mutates the dictionary107# The copy of juju_data is needed because Message mutates the dictionary
116JUJU_INFO = Message("juju-info",
117 juju_data.copy(),
118 optional=["private-address"])
119
120JUJU_UNITS_INFO = Message("juju-units-info", {108JUJU_UNITS_INFO = Message("juju-units-info", {
121 "juju-info-list": List(KeyDict(juju_data.copy(),109 "juju-info-list": List(KeyDict(juju_data.copy(),
122 optional=["private-address"]))110 optional=["private-address"]))
@@ -196,18 +184,37 @@
196 "tags": Any(Unicode(), Constant(None)),184 "tags": Any(Unicode(), Constant(None)),
197 "vm-info": Bytes(),185 "vm-info": Bytes(),
198 "container-info": Unicode(),186 "container-info": Unicode(),
199 "juju-info": KeyDict(juju_data, optional=["private-address"]),187 "access_group": Unicode()},
200 # Because of backwards compatibility we need another member with the list188 optional=["registration_password", "hostname", "tags", "vm-info",
201 # of juju-info, so it can safely be ignored by old servers.189 "container-info", "access_group"])
190
191
192REGISTER_3_3 = Message(
193 "register",
194 # The term used in the UI is actually 'registration_key', but we keep
195 # the message schema field as 'registration_password' in case a new
196 # client contacts an older server.
197 {"registration_password": Any(Unicode(), Constant(None)),
198 "computer_title": Unicode(),
199 "hostname": Unicode(),
200 "account_name": Unicode(),
201 "tags": Any(Unicode(), Constant(None)),
202 "vm-info": Bytes(),
203 "container-info": Unicode(),
204 "juju-info": KeyDict({"environment-uuid": Unicode(),
205 "api-addresses": List(Unicode()),
206 "machine-id": Unicode()}),
207 # XXX temporary field with unit info, will be dropped when we complete
208 # the migration to machine info.
202 "juju-info-list": List(KeyDict(juju_data, optional=["private-address"])),209 "juju-info-list": List(KeyDict(juju_data, optional=["private-address"])),
203 "access_group": Unicode()},210 "access_group": Unicode()},
211 api="3.3",
204 optional=["registration_password", "hostname", "tags", "vm-info",212 optional=["registration_password", "hostname", "tags", "vm-info",
205 "container-info", "juju-info", "juju-info-list", "unicode",213 "container-info", "access_group", "juju-info", "juju-info-list"])
206 "access_group"])
207214
208215
209# XXX The register-provisioned-machine message is obsolete, it's kept around216# XXX The register-provisioned-machine message is obsolete, it's kept around
210# just to not break older LDS releases that import it the last LDS release217# just to not break older LDS releases that import it (the last LDS release
211# to have it is 14.07). Eventually it shall be dropped.218# to have it is 14.07). Eventually it shall be dropped.
212REGISTER_PROVISIONED_MACHINE = Message(219REGISTER_PROVISIONED_MACHINE = Message(
213 "register-provisioned-machine",220 "register-provisioned-machine",
@@ -238,6 +245,7 @@
238 "access_group": Unicode()},245 "access_group": Unicode()},
239 optional=["tags", "vm-info", "public_ipv4", "local_ipv4", "access_group"])246 optional=["tags", "vm-info", "public_ipv4", "local_ipv4", "access_group"])
240247
248
241TEMPERATURE = Message("temperature", {249TEMPERATURE = Message("temperature", {
242 "thermal-zone": Unicode(),250 "thermal-zone": Unicode(),
243 "temperatures": List(Tuple(Int(), Float())),251 "temperatures": List(Tuple(Int(), Float())),
@@ -482,7 +490,7 @@
482 OPERATION_RESULT, COMPUTER_INFO, DISTRIBUTION_INFO,490 OPERATION_RESULT, COMPUTER_INFO, DISTRIBUTION_INFO,
483 HARDWARE_INVENTORY, HARDWARE_INFO, LOAD_AVERAGE, MEMORY_INFO,491 HARDWARE_INVENTORY, HARDWARE_INFO, LOAD_AVERAGE, MEMORY_INFO,
484 RESYNCHRONIZE, MOUNT_ACTIVITY, MOUNT_INFO, FREE_SPACE,492 RESYNCHRONIZE, MOUNT_ACTIVITY, MOUNT_INFO, FREE_SPACE,
485 REGISTER,493 REGISTER, REGISTER_3_3,
486 TEMPERATURE, PROCESSOR_INFO, USERS, PACKAGES, PACKAGE_LOCKS,494 TEMPERATURE, PROCESSOR_INFO, USERS, PACKAGES, PACKAGE_LOCKS,
487 CHANGE_PACKAGES_RESULT, UNKNOWN_PACKAGE_HASHES,495 CHANGE_PACKAGES_RESULT, UNKNOWN_PACKAGE_HASHES,
488 ADD_PACKAGES, PACKAGE_REPORTER_RESULT, TEXT_MESSAGE, TEST,496 ADD_PACKAGES, PACKAGE_REPORTER_RESULT, TEXT_MESSAGE, TEST,
@@ -490,4 +498,4 @@
490 NETWORK_DEVICE, NETWORK_ACTIVITY,498 NETWORK_DEVICE, NETWORK_ACTIVITY,
491 REBOOT_REQUIRED_INFO, UPDATE_MANAGER_INFO, CPU_USAGE,499 REBOOT_REQUIRED_INFO, UPDATE_MANAGER_INFO, CPU_USAGE,
492 CEPH_USAGE, SWIFT_USAGE, SWIFT_DEVICE_INFO, KEYSTONE_TOKEN,500 CEPH_USAGE, SWIFT_USAGE, SWIFT_DEVICE_INFO, KEYSTONE_TOKEN,
493 CHANGE_HA_SERVICE, JUJU_INFO, JUJU_UNITS_INFO, CLOUD_METADATA)501 CHANGE_HA_SERVICE, JUJU_UNITS_INFO, CLOUD_METADATA)
494502
=== modified file 'landscape/monitor/tests/test_activeprocessinfo.py'
--- landscape/monitor/tests/test_activeprocessinfo.py 2013-07-17 07:26:31 +0000
+++ landscape/monitor/tests/test_activeprocessinfo.py 2014-09-01 13:16:19 +0000
@@ -10,7 +10,6 @@
10from landscape.tests.helpers import (LandscapeTest, MonitorHelper,10from landscape.tests.helpers import (LandscapeTest, MonitorHelper,
11 ProcessDataBuilder)11 ProcessDataBuilder)
12from landscape.tests.mocker import ANY12from landscape.tests.mocker import ANY
13from landscape import SERVER_API
1413
1514
16class ActiveProcessInfoTest(LandscapeTest):15class ActiveProcessInfoTest(LandscapeTest):
@@ -577,7 +576,7 @@
577 messages = self.mstore.get_pending_messages()576 messages = self.mstore.get_pending_messages()
578 self.assertEqual(len(messages), 2)577 self.assertEqual(len(messages), 2)
579 self.assertMessages(messages, [{"timestamp": 0,578 self.assertMessages(messages, [{"timestamp": 0,
580 "api": SERVER_API,579 "api": "3.2",
581 "type": "active-process-info",580 "type": "active-process-info",
582 "kill-all-processes": True,581 "kill-all-processes": True,
583 "add-processes": [{"start-time": 110,582 "add-processes": [{"start-time": 110,
@@ -589,7 +588,7 @@
589 "vm-size": 11676,588 "vm-size": 11676,
590 "uid": 0}]},589 "uid": 0}]},
591 {"timestamp": 0,590 {"timestamp": 0,
592 "api": SERVER_API,591 "api": "3.2",
593 "type": "active-process-info",592 "type": "active-process-info",
594 "update-processes": [593 "update-processes": [
595 {"start-time": 110,594 {"start-time": 110,

Subscribers

People subscribed via source and target branches

to all changes: