Merge lp:~therve/landscape-client/cloud-ip-addresses into lp:~landscape/landscape-client/trunk

Proposed by Thomas Herve
Status: Merged
Approved by: Free Ekanayaka
Approved revision: 434
Merged at revision: 436
Proposed branch: lp:~therve/landscape-client/cloud-ip-addresses
Merge into: lp:~landscape/landscape-client/trunk
Diff against target: 84 lines (+18/-6)
3 files modified
landscape/broker/registration.py (+8/-3)
landscape/broker/tests/test_registration.py (+6/-1)
landscape/message_schemas.py (+4/-2)
To merge this branch: bzr merge lp:~therve/landscape-client/cloud-ip-addresses
Reviewer Review Type Date Requested Status
Free Ekanayaka (community) Approve
Alberto Donato (community) Approve
Review via email: mp+89453@code.launchpad.net

Description of the change

The branch reports 2 new infos from the metadata. IIRC it should be OK with old servers, and the fields are marked optionals for old clients.

To post a comment you must log in.
Revision history for this message
Alberto Donato (ack) wrote :

Looks good to me, +1!

review: Approve
Revision history for this message
Free Ekanayaka (free.ekanayaka) wrote :

Cool, +1!

I guess we'll need a server-side branch too, to make use of the new meta-data?

Revision history for this message
Free Ekanayaka (free.ekanayaka) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'landscape/broker/registration.py'
2--- landscape/broker/registration.py 2011-11-11 12:30:53 +0000
3+++ landscape/broker/registration.py 2012-01-20 15:22:36 +0000
4@@ -149,7 +149,9 @@
5 "/meta-data/public-hostname",
6 "/meta-data/ami-launch-index",
7 "/meta-data/kernel-id",
8- "/meta-data/ami-id"]
9+ "/meta-data/ami-id",
10+ "/meta-data/local-ipv4",
11+ "/meta-data/public-ipv4"]
12 # We're not using a DeferredList here because we want to keep the
13 # number of connections to the backend minimal. See lp:567515.
14 for path in paths:
15@@ -165,7 +167,8 @@
16 """Record the instance data returned by the EC2 API."""
17 (raw_user_data, instance_key, reservation_key,
18 local_hostname, public_hostname, launch_index,
19- kernel_key, ami_key, ramdisk_key) = ec2_data
20+ kernel_key, ami_key, local_ip,
21+ public_ip, ramdisk_key) = ec2_data
22 self._ec2_data = {
23 "instance_key": instance_key,
24 "reservation_key": reservation_key,
25@@ -174,7 +177,9 @@
26 "launch_index": launch_index,
27 "kernel_key": kernel_key,
28 "ramdisk_key": ramdisk_key,
29- "image_key": ami_key}
30+ "image_key": ami_key,
31+ "public_ipv4": public_ip,
32+ "local_ipv4": local_ip}
33 for k, v in self._ec2_data.items():
34 if v is None and k == "ramdisk_key":
35 continue
36
37=== modified file 'landscape/broker/tests/test_registration.py'
38--- landscape/broker/tests/test_registration.py 2011-11-29 15:11:35 +0000
39+++ landscape/broker/tests/test_registration.py 2012-01-20 15:22:36 +0000
40@@ -502,7 +502,8 @@
41 self, user_data=None, instance_key="key1", launch_index=0,
42 local_hostname="ooga.local", public_hostname="ooga.amazon.com",
43 reservation_key=u"res1", ramdisk_key=u"ram1", kernel_key=u"kernel1",
44- image_key=u"image1", ssl_ca_certificate=None):
45+ image_key=u"image1", local_ip="10.0.0.1", public_ip="10.0.0.2",
46+ ssl_ca_certificate=None):
47 if user_data is None:
48 user_data = self.get_user_data(
49 ssl_ca_certificate=ssl_ca_certificate)
50@@ -520,6 +521,8 @@
51 ("/meta-data/kernel-id", kernel_key),
52 ("/meta-data/ramdisk-id", ramdisk_key),
53 ("/meta-data/ami-id", image_key),
54+ ("/meta-data/local-ipv4", local_ip),
55+ ("/meta-data/public-ipv4", public_ip),
56 ]:
57 self.query_results[api_base + url_suffix] = value
58
59@@ -553,6 +556,8 @@
60 image_key=u"image1",
61 account_name=None,
62 registration_password=None,
63+ local_ipv4=u"10.0.0.1",
64+ public_ipv4=u"10.0.0.2",
65 tags=None)
66
67 # The get_vm_info() needs to be deffered to the else. If vm-info is
68
69=== modified file 'landscape/message_schemas.py'
70--- landscape/message_schemas.py 2012-01-18 12:37:53 +0000
71+++ landscape/message_schemas.py 2012-01-20 15:22:36 +0000
72@@ -168,8 +168,10 @@
73 "launch_index": Int(),
74 "image_key": Unicode(),
75 "tags": Any(utf8, Constant(None)),
76- "vm-info": String()},
77- optional=["tags", "vm-info"])
78+ "vm-info": String(),
79+ "public_ipv4": Unicode(),
80+ "local_ipv4": Unicode()},
81+ optional=["tags", "vm-info", "public_ipv4", "local_ipv4"])
82
83 TEMPERATURE = Message("temperature", {
84 "thermal-zone": utf8,

Subscribers

People subscribed via source and target branches

to all changes: