Merge lp:~tribaal/landscape-client/rename-metadata-annotations into lp:~landscape/landscape-client/trunk
- rename-metadata-annotations
- Merge into trunk
Status: | Merged | ||||
---|---|---|---|---|---|
Approved by: | Chris Glass | ||||
Approved revision: | 732 | ||||
Merged at revision: | 725 | ||||
Proposed branch: | lp:~tribaal/landscape-client/rename-metadata-annotations | ||||
Merge into: | lp:~landscape/landscape-client/trunk | ||||
Diff against target: |
310 lines (+64/-53) 8 files modified
landscape/configuration.py (+3/-2) landscape/deployment.py (+3/-3) landscape/message_schemas.py (+2/-4) landscape/monitor/computerinfo.py (+13/-11) landscape/monitor/tests/test_computerinfo.py (+27/-19) landscape/tests/test_configuration.py (+5/-5) landscape/tests/test_deployment.py (+5/-5) landscape/user/management.py (+6/-4) |
||||
To merge this branch: | bzr merge lp:~tribaal/landscape-client/rename-metadata-annotations | ||||
Related bugs: |
|
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Free Ekanayaka (community) | Approve | ||
Alberto Donato (community) | Approve | ||
Review via email: mp+185990@code.launchpad.net |
Commit message
This branch renames the meta-data.d/ directory to annotations.d/
Description of the change
This branch renames the meta-data.d/ directory to annotations.d/
One small non-related change too, where the log for the User credential were referring to "metadata" while it is in fact not meta data.
I would like to get an initial review on this, but I may have to retarget the branch depending on the release strategy we want to adopt (should we release the whole trunk since last release or just backport changes).
- 726. By Chris Glass
-
Fix typo in docstring
Alberto Donato (ack) wrote : | # |
Just as a note, the landscape-client charm will be broken when this lands, as it relies on config.
My charm branch (lp:~ack/charms/precise/landscape-client/separate-juju-info) in review fixes that.
- 727. By Chris Glass
-
Addresses comment #1 - using generic annotations instead of juju-specific ones
to avoid confusion.
Renamed variables and test methods.
Free Ekanayaka (free.ekanayaka) wrote : | # |
A few things to fix, re the releasing strategy we agreed on backporting, which should be a straight patch as we didn't touch much this code (if at all).
[1]
We need to disable the fetching of cloud meta data too (which would currently end up in the annotations). It's a very small change and should go in this branch.
[2]
The ComputerInfo plugin is still using "meta-data" as message type name (line 92).
[3]
The message type name is still "meta-data" in landscape/
Chris Glass (tribaal) wrote : | # |
I have in progress bugs and branches for those exact points - would you rather have me smash them all together in this branch?
Works for me either way.
- 728. By Chris Glass
-
Merging second development branch into this one.
The merge branch changes the message key from "meta-data" to "annotations".Remains to be done: One branch to deactivate the EC2 reporting code (in a separate branch so that we can reactivate it easily in the future).
- 729. By Chris Glass
-
Reanamed internal variable from meta_data to annotations.
- 730. By Chris Glass
-
Lint fixes
Free Ekanayaka (free.ekanayaka) wrote : | # |
Thanks, looks good to me, it seems the only point left is [1] and will go in the other branch. +1!
- 731. By Chris Glass
-
Deactivate EC2 reporting for the time being.
- 732. By Chris Glass
-
Added bug number to "deactivated" comments.
Chris Glass (tribaal) wrote : | # |
I changed my mind and added the removal in this branch since it's very cheap.
Please add a quick comment if it's still +1
Free Ekanayaka (free.ekanayaka) wrote : | # |
+1!
Preview Diff
1 | === modified file 'landscape/configuration.py' | |||
2 | --- landscape/configuration.py 2013-09-16 08:09:10 +0000 | |||
3 | +++ landscape/configuration.py 2013-09-18 08:41:57 +0000 | |||
4 | @@ -588,9 +588,10 @@ | |||
5 | 588 | """Create the client directories tree.""" | 588 | """Create the client directories tree.""" |
6 | 589 | bootstrap_list = [ | 589 | bootstrap_list = [ |
7 | 590 | BootstrapDirectory("$data_path", "landscape", "root", 0755), | 590 | BootstrapDirectory("$data_path", "landscape", "root", 0755), |
9 | 591 | BootstrapDirectory("$meta_data_path", "landscape", "landscape", 0755)] | 591 | BootstrapDirectory("$annotations_path", "landscape", "landscape", |
10 | 592 | 0755)] | ||
11 | 592 | BootstrapList(bootstrap_list).bootstrap( | 593 | BootstrapList(bootstrap_list).bootstrap( |
13 | 593 | data_path=config.data_path, meta_data_path=config.meta_data_path) | 594 | data_path=config.data_path, annotations_path=config.annotations_path) |
14 | 594 | 595 | ||
15 | 595 | 596 | ||
16 | 596 | def store_public_key_data(config, certificate_data): | 597 | def store_public_key_data(config, certificate_data): |
17 | 597 | 598 | ||
18 | === modified file 'landscape/deployment.py' | |||
19 | --- landscape/deployment.py 2013-09-16 08:09:10 +0000 | |||
20 | +++ landscape/deployment.py 2013-09-18 08:41:57 +0000 | |||
21 | @@ -399,12 +399,12 @@ | |||
22 | 399 | return os.path.join(self.data_path, "sockets") | 399 | return os.path.join(self.data_path, "sockets") |
23 | 400 | 400 | ||
24 | 401 | @property | 401 | @property |
26 | 402 | def meta_data_path(self): | 402 | def annotations_path(self): |
27 | 403 | """ | 403 | """ |
29 | 404 | Return the path to the directory where additional meta-data files can | 404 | Return the path to the directory where additional annotation files can |
30 | 405 | be stored. | 405 | be stored. |
31 | 406 | """ | 406 | """ |
33 | 407 | return os.path.join(self.data_path, "meta-data.d") | 407 | return os.path.join(self.data_path, "annotations.d") |
34 | 408 | 408 | ||
35 | 409 | 409 | ||
36 | 410 | def get_versioned_persist(service): | 410 | def get_versioned_persist(service): |
37 | 411 | 411 | ||
38 | === modified file 'landscape/message_schemas.py' | |||
39 | --- landscape/message_schemas.py 2013-08-21 16:33:46 +0000 | |||
40 | +++ landscape/message_schemas.py 2013-09-18 08:41:57 +0000 | |||
41 | @@ -69,12 +69,10 @@ | |||
42 | 69 | {"hostname": utf8, | 69 | {"hostname": utf8, |
43 | 70 | "total-memory": Int(), | 70 | "total-memory": Int(), |
44 | 71 | "total-swap": Int(), | 71 | "total-swap": Int(), |
47 | 72 | "meta-data": Dict(utf8, utf8), | 72 | "annotations": Dict(utf8, utf8)}, |
46 | 73 | "extra-meta-data": Dict(utf8, utf8)}, | ||
48 | 74 | # Not sure why these are all optional, but it's explicitly tested | 73 | # Not sure why these are all optional, but it's explicitly tested |
49 | 75 | # in the server | 74 | # in the server |
52 | 76 | optional=["hostname", "total-memory", "total-swap", "meta-data", | 75 | optional=["hostname", "total-memory", "total-swap", "annotations"]) |
51 | 77 | "extra-meta-data"]) | ||
53 | 78 | 76 | ||
54 | 79 | DISTRIBUTION_INFO = Message( | 77 | DISTRIBUTION_INFO = Message( |
55 | 80 | "distribution-info", | 78 | "distribution-info", |
56 | 81 | 79 | ||
57 | === modified file 'landscape/monitor/computerinfo.py' | |||
58 | --- landscape/monitor/computerinfo.py 2013-09-07 22:06:20 +0000 | |||
59 | +++ landscape/monitor/computerinfo.py 2013-09-18 08:41:57 +0000 | |||
60 | @@ -36,7 +36,7 @@ | |||
61 | 36 | 36 | ||
62 | 37 | def register(self, registry): | 37 | def register(self, registry): |
63 | 38 | super(ComputerInfo, self).register(registry) | 38 | super(ComputerInfo, self).register(registry) |
65 | 39 | self._meta_data_path = registry.config.meta_data_path | 39 | self._annotations_path = registry.config.annotations_path |
66 | 40 | self.call_on_accepted("computer-info", | 40 | self.call_on_accepted("computer-info", |
67 | 41 | self.send_computer_message, True) | 41 | self.send_computer_message, True) |
68 | 42 | self.call_on_accepted("distribution-info", | 42 | self.call_on_accepted("distribution-info", |
69 | @@ -75,21 +75,23 @@ | |||
70 | 75 | self._add_if_new(message, "total-memory", | 75 | self._add_if_new(message, "total-memory", |
71 | 76 | total_memory) | 76 | total_memory) |
72 | 77 | self._add_if_new(message, "total-swap", total_swap) | 77 | self._add_if_new(message, "total-swap", total_swap) |
78 | 78 | meta_data = {} | 78 | annotations = {} |
79 | 79 | if os.path.exists(self._meta_data_path): | 79 | if os.path.exists(self._annotations_path): |
80 | 80 | for key in os.listdir(self._meta_data_path): | 80 | for key in os.listdir(self._annotations_path): |
81 | 81 | meta_data[key] = read_file( | 81 | annotations[key] = read_file( |
82 | 82 | os.path.join(self._meta_data_path, key)) | 82 | os.path.join(self._annotations_path, key)) |
83 | 83 | 83 | ||
84 | 84 | if (self._cloud_meta_data is None and | 84 | if (self._cloud_meta_data is None and |
85 | 85 | self._cloud_retries < METADATA_RETRY_MAX): | 85 | self._cloud_retries < METADATA_RETRY_MAX): |
86 | 86 | self._cloud_meta_data = yield self._fetch_ec2_meta_data() | 86 | self._cloud_meta_data = yield self._fetch_ec2_meta_data() |
87 | 87 | 87 | ||
93 | 88 | if self._cloud_meta_data: | 88 | # XXX: Deactivated EC2 reporting for the time being, until #1226605 is |
94 | 89 | meta_data = dict( | 89 | # implemented. |
95 | 90 | meta_data.items() + self._cloud_meta_data.items()) | 90 | if False: # if self._cloud_meta_data: |
96 | 91 | if meta_data: | 91 | annotations = dict( |
97 | 92 | self._add_if_new(message, "meta-data", meta_data) | 92 | annotations.items() + self._cloud_meta_data.items()) |
98 | 93 | if annotations: | ||
99 | 94 | self._add_if_new(message, "annotations", annotations) | ||
100 | 93 | returnValue(message) | 95 | returnValue(message) |
101 | 94 | 96 | ||
102 | 95 | def _add_if_new(self, message, key, value): | 97 | def _add_if_new(self, message, key, value): |
103 | 96 | 98 | ||
104 | === modified file 'landscape/monitor/tests/test_computerinfo.py' | |||
105 | --- landscape/monitor/tests/test_computerinfo.py 2013-09-06 19:48:16 +0000 | |||
106 | +++ landscape/monitor/tests/test_computerinfo.py 2013-09-18 08:41:57 +0000 | |||
107 | @@ -310,9 +310,15 @@ | |||
108 | 310 | computer_info = {"type": "computer-info", "hostname": "ooga.local", | 310 | computer_info = {"type": "computer-info", "hostname": "ooga.local", |
109 | 311 | "timestamp": 0, "total-memory": 1510, | 311 | "timestamp": 0, "total-memory": 1510, |
110 | 312 | "total-swap": 1584, | 312 | "total-swap": 1584, |
114 | 313 | "meta-data": {u"ami-id": u"ami-00002", | 313 | "annotations": {u"ami-id": u"ami-00002", |
115 | 314 | u"instance-id": u"i00001", | 314 | u"instance-id": u"i00001", |
116 | 315 | u"instance-type": u"hs1.8xlarge"}} | 315 | u"instance-type": u"hs1.8xlarge"}} |
117 | 316 | # XXX: The tested code is deactivated, so this will not produce | ||
118 | 317 | # annotations for the time being. It should be plugged in again | ||
119 | 318 | # once #1226605 is implemented. | ||
120 | 319 | computer_info = {"type": "computer-info", "hostname": "ooga.local", | ||
121 | 320 | "timestamp": 0, "total-memory": 1510, | ||
122 | 321 | "total-swap": 1584} | ||
123 | 316 | dist_info = {"type": "distribution-info", | 322 | dist_info = {"type": "distribution-info", |
124 | 317 | "code-name": "dapper", "description": "Ubuntu 6.06.1 LTS", | 323 | "code-name": "dapper", "description": "Ubuntu 6.06.1 LTS", |
125 | 318 | "distributor-id": "Ubuntu", "release": "6.06"} | 324 | "distributor-id": "Ubuntu", "release": "6.06"} |
126 | @@ -358,9 +364,9 @@ | |||
127 | 358 | self.mstore.set_accepted_types(["distribution-info", "computer-info"]) | 364 | self.mstore.set_accepted_types(["distribution-info", "computer-info"]) |
128 | 359 | self.assertMessages(list(self.mstore.get_pending_messages()), []) | 365 | self.assertMessages(list(self.mstore.get_pending_messages()), []) |
129 | 360 | 366 | ||
131 | 361 | def test_meta_data(self): | 367 | def test_annotations(self): |
132 | 362 | """ | 368 | """ |
134 | 363 | L{ComputerInfo} sends extra meta data from the meta-data.d directory | 369 | L{ComputerInfo} sends extra meta data from the annotations.d directory |
135 | 364 | if it's present. | 370 | if it's present. |
136 | 365 | 371 | ||
137 | 366 | Each file name is used as a key in the meta-data dict and the file's | 372 | Each file name is used as a key in the meta-data dict and the file's |
138 | @@ -369,10 +375,10 @@ | |||
139 | 369 | This allows, for example, the landscape-client charm to send | 375 | This allows, for example, the landscape-client charm to send |
140 | 370 | information about the juju environment to the landscape server. | 376 | information about the juju environment to the landscape server. |
141 | 371 | """ | 377 | """ |
146 | 372 | meta_data_dir = self.monitor.config.meta_data_path | 378 | annotations_dir = self.monitor.config.annotations_path |
147 | 373 | os.mkdir(meta_data_dir) | 379 | os.mkdir(annotations_dir) |
148 | 374 | create_file(os.path.join(meta_data_dir, "juju-env-uuid"), "uuid1") | 380 | create_file(os.path.join(annotations_dir, "annotation1"), "value1") |
149 | 375 | create_file(os.path.join(meta_data_dir, "juju-unit-name"), "unit/0") | 381 | create_file(os.path.join(annotations_dir, "annotation2"), "value2") |
150 | 376 | self.mstore.set_accepted_types(["computer-info"]) | 382 | self.mstore.set_accepted_types(["computer-info"]) |
151 | 377 | 383 | ||
152 | 378 | plugin = ComputerInfo() | 384 | plugin = ComputerInfo() |
153 | @@ -381,16 +387,17 @@ | |||
154 | 381 | plugin.exchange() | 387 | plugin.exchange() |
155 | 382 | messages = self.mstore.get_pending_messages() | 388 | messages = self.mstore.get_pending_messages() |
156 | 383 | self.assertEqual(1, len(messages)) | 389 | self.assertEqual(1, len(messages)) |
158 | 384 | meta_data = messages[0]["meta-data"] | 390 | meta_data = messages[0]["annotations"] |
159 | 385 | self.assertEqual(2, len(meta_data)) | 391 | self.assertEqual(2, len(meta_data)) |
162 | 386 | self.assertEqual("uuid1", meta_data["juju-env-uuid"]) | 392 | self.assertEqual("value1", meta_data["annotation1"]) |
163 | 387 | self.assertEqual("unit/0", meta_data["juju-unit-name"]) | 393 | self.assertEqual("value2", meta_data["annotation2"]) |
164 | 388 | 394 | ||
166 | 389 | def test_meta_data_cloud(self): | 395 | def deactivated_test_annotations_cloud(self): |
167 | 390 | """ | 396 | """ |
168 | 391 | L{ComputerInfo} includes the meta-data key when cloud information | 397 | L{ComputerInfo} includes the meta-data key when cloud information |
169 | 392 | is available. | 398 | is available. |
170 | 393 | """ | 399 | """ |
171 | 400 | # XXX The tested code is deactivated until #1226605 is implemented. | ||
172 | 394 | self.mstore.set_accepted_types(["computer-info"]) | 401 | self.mstore.set_accepted_types(["computer-info"]) |
173 | 395 | 402 | ||
174 | 396 | plugin = ComputerInfo() | 403 | plugin = ComputerInfo() |
175 | @@ -399,11 +406,12 @@ | |||
176 | 399 | plugin.exchange() | 406 | plugin.exchange() |
177 | 400 | messages = self.mstore.get_pending_messages() | 407 | messages = self.mstore.get_pending_messages() |
178 | 401 | self.assertEqual(1, len(messages)) | 408 | self.assertEqual(1, len(messages)) |
181 | 402 | self.assertIn("meta-data", messages[0]) | 409 | self.assertIn("annotations", messages[0]) |
182 | 403 | self.assertEqual("i00001", messages[0]["meta-data"]["instance-id"]) | 410 | self.assertEqual("i00001", messages[0]["annotations"]["instance-id"]) |
183 | 404 | 411 | ||
185 | 405 | def test_with_cloud_info(self): | 412 | def deactivated_test_with_cloud_info(self): |
186 | 406 | """Fetch cloud information""" | 413 | """Fetch cloud information""" |
187 | 414 | # XXX: The tested code is deactivated until #1226605 is implemented. | ||
188 | 407 | self.config.cloud = True | 415 | self.config.cloud = True |
189 | 408 | self.mstore.set_accepted_types(["computer-info"]) | 416 | self.mstore.set_accepted_types(["computer-info"]) |
190 | 409 | 417 | ||
191 | @@ -412,11 +420,11 @@ | |||
192 | 412 | plugin.exchange() | 420 | plugin.exchange() |
193 | 413 | messages = self.mstore.get_pending_messages() | 421 | messages = self.mstore.get_pending_messages() |
194 | 414 | self.assertEqual(1, len(messages)) | 422 | self.assertEqual(1, len(messages)) |
196 | 415 | self.assertIn("meta-data", messages[0]) | 423 | self.assertIn("annotations", messages[0]) |
197 | 416 | 424 | ||
198 | 417 | self.assertEqual({"instance-id": u"i00001", "ami-id": u"ami-00002", | 425 | self.assertEqual({"instance-id": u"i00001", "ami-id": u"ami-00002", |
199 | 418 | "instance-type": u"hs1.8xlarge"}, | 426 | "instance-type": u"hs1.8xlarge"}, |
201 | 419 | messages[0]["meta-data"]) | 427 | messages[0]["annotations"]) |
202 | 420 | 428 | ||
203 | 421 | def test_no_fetch_ec2_meta_data_when_cloud_retries_is_max(self): | 429 | def test_no_fetch_ec2_meta_data_when_cloud_retries_is_max(self): |
204 | 422 | """ | 430 | """ |
205 | @@ -431,7 +439,7 @@ | |||
206 | 431 | plugin.exchange() | 439 | plugin.exchange() |
207 | 432 | messages = self.mstore.get_pending_messages() | 440 | messages = self.mstore.get_pending_messages() |
208 | 433 | self.assertEqual(1, len(messages)) | 441 | self.assertEqual(1, len(messages)) |
210 | 434 | self.assertNotIn("meta-data", messages[0]) | 442 | self.assertNotIn("annotations", messages[0]) |
211 | 435 | 443 | ||
212 | 436 | @inlineCallbacks | 444 | @inlineCallbacks |
213 | 437 | def test_fetch_ec2_meta_data(self): | 445 | def test_fetch_ec2_meta_data(self): |
214 | 438 | 446 | ||
215 | === modified file 'landscape/tests/test_configuration.py' | |||
216 | --- landscape/tests/test_configuration.py 2013-09-16 07:45:45 +0000 | |||
217 | +++ landscape/tests/test_configuration.py 2013-09-18 08:41:57 +0000 | |||
218 | @@ -639,21 +639,21 @@ | |||
219 | 639 | 639 | ||
220 | 640 | def test_bootstrap_tree(self): | 640 | def test_bootstrap_tree(self): |
221 | 641 | """ | 641 | """ |
224 | 642 | The L{bootstrap_tree} function creates the client dir and /meta-data.d | 642 | The L{bootstrap_tree} function creates the client dir and |
225 | 643 | under it with the correct permissions. | 643 | /annotations.d under it with the correct permissions. |
226 | 644 | """ | 644 | """ |
227 | 645 | client_path = self.makeDir() | 645 | client_path = self.makeDir() |
229 | 646 | meta_data_path = os.path.join(client_path, "meta-data.d") | 646 | annotations_path = os.path.join(client_path, "annotations.d") |
230 | 647 | 647 | ||
231 | 648 | mock_chmod = self.mocker.replace("os.chmod") | 648 | mock_chmod = self.mocker.replace("os.chmod") |
232 | 649 | mock_chmod(client_path, 0755) | 649 | mock_chmod(client_path, 0755) |
234 | 650 | mock_chmod(meta_data_path, 0755) | 650 | mock_chmod(annotations_path, 0755) |
235 | 651 | self.mocker.replay() | 651 | self.mocker.replay() |
236 | 652 | 652 | ||
237 | 653 | config = self.get_config([], data_path=client_path) | 653 | config = self.get_config([], data_path=client_path) |
238 | 654 | bootstrap_tree(config) | 654 | bootstrap_tree(config) |
239 | 655 | self.assertTrue(os.path.isdir(client_path)) | 655 | self.assertTrue(os.path.isdir(client_path)) |
241 | 656 | self.assertTrue(os.path.isdir(meta_data_path)) | 656 | self.assertTrue(os.path.isdir(annotations_path)) |
242 | 657 | 657 | ||
243 | 658 | 658 | ||
244 | 659 | class ConfigurationFunctionsTest(LandscapeConfigurationTest): | 659 | class ConfigurationFunctionsTest(LandscapeConfigurationTest): |
245 | 660 | 660 | ||
246 | === modified file 'landscape/tests/test_deployment.py' | |||
247 | --- landscape/tests/test_deployment.py 2013-09-16 08:10:04 +0000 | |||
248 | +++ landscape/tests/test_deployment.py 2013-09-18 08:41:57 +0000 | |||
249 | @@ -600,14 +600,14 @@ | |||
250 | 600 | self.assertEqual(self.config.sockets_path, | 600 | self.assertEqual(self.config.sockets_path, |
251 | 601 | "/var/lib/landscape/client/sockets") | 601 | "/var/lib/landscape/client/sockets") |
252 | 602 | 602 | ||
254 | 603 | def test_meta_data_path(self): | 603 | def test_annotations_path(self): |
255 | 604 | """ | 604 | """ |
258 | 605 | The L{Configuration.meta_data_path} property returns the path to the | 605 | The L{Configuration.annotations_path} property returns the path to the |
259 | 606 | socket directory. | 606 | annotations directory. |
260 | 607 | """ | 607 | """ |
261 | 608 | self.assertEqual( | 608 | self.assertEqual( |
264 | 609 | "/var/lib/landscape/client/meta-data.d", | 609 | "/var/lib/landscape/client/annotations.d", |
265 | 610 | self.config.meta_data_path) | 610 | self.config.annotations_path) |
266 | 611 | 611 | ||
267 | 612 | def test_clone(self): | 612 | def test_clone(self): |
268 | 613 | """The L{Configuration.clone} method clones a configuration.""" | 613 | """The L{Configuration.clone} method clones a configuration.""" |
269 | 614 | 614 | ||
270 | === modified file 'landscape/user/management.py' | |||
271 | --- landscape/user/management.py 2008-06-17 09:49:54 +0000 | |||
272 | +++ landscape/user/management.py 2013-09-18 08:41:57 +0000 | |||
273 | @@ -41,7 +41,7 @@ | |||
274 | 41 | self._set_password(username, password) | 41 | self._set_password(username, password) |
275 | 42 | if require_password_reset: | 42 | if require_password_reset: |
276 | 43 | result, new_output = self.call_popen(["passwd", username, "-e"]) | 43 | result, new_output = self.call_popen(["passwd", username, "-e"]) |
278 | 44 | if result !=0: | 44 | if result != 0: |
279 | 45 | raise UserManagementError("Error resetting password for user " | 45 | raise UserManagementError("Error resetting password for user " |
280 | 46 | "%s.\n%s" % (username, new_output)) | 46 | "%s.\n%s" % (username, new_output)) |
281 | 47 | else: | 47 | else: |
282 | @@ -75,7 +75,7 @@ | |||
283 | 75 | primary_group_name=None): | 75 | primary_group_name=None): |
284 | 76 | """Update details for the account matching C{uid}.""" | 76 | """Update details for the account matching C{uid}.""" |
285 | 77 | uid = self._provider.get_uid(username) | 77 | uid = self._provider.get_uid(username) |
287 | 78 | logging.info("Updating metadata for user %s (UID %d).", username, uid) | 78 | logging.info("Updating data for user %s (UID %d).", username, uid) |
288 | 79 | if password: | 79 | if password: |
289 | 80 | self._set_password(username, password) | 80 | self._set_password(username, password) |
290 | 81 | 81 | ||
291 | @@ -166,7 +166,8 @@ | |||
292 | 166 | gid = self._provider.get_gid(groupname) | 166 | gid = self._provider.get_gid(groupname) |
293 | 167 | logging.info("Adding user %s (UID %d) to group %s (GID %d).", | 167 | logging.info("Adding user %s (UID %d) to group %s (GID %d).", |
294 | 168 | username, uid, groupname, gid) | 168 | username, uid, groupname, gid) |
296 | 169 | result, output = self.call_popen(["gpasswd", "-a", username, groupname]) | 169 | result, output = self.call_popen(["gpasswd", "-a", username, |
297 | 170 | groupname]) | ||
298 | 170 | if result != 0: | 171 | if result != 0: |
299 | 171 | raise UserManagementError("Error adding user %s (UID %d) to " | 172 | raise UserManagementError("Error adding user %s (UID %d) to " |
300 | 172 | "group %s (GID %d).\n%s" % | 173 | "group %s (GID %d).\n%s" % |
301 | @@ -182,7 +183,8 @@ | |||
302 | 182 | gid = self._provider.get_gid(groupname) | 183 | gid = self._provider.get_gid(groupname) |
303 | 183 | logging.info("Removing user %s (UID %d) from group %s (GID %d).", | 184 | logging.info("Removing user %s (UID %d) from group %s (GID %d).", |
304 | 184 | username, uid, groupname, gid) | 185 | username, uid, groupname, gid) |
306 | 185 | result, output = self.call_popen(["gpasswd", "-d", username, groupname]) | 186 | result, output = self.call_popen(["gpasswd", "-d", username, |
307 | 187 | groupname]) | ||
308 | 186 | if result != 0: | 188 | if result != 0: |
309 | 187 | raise UserManagementError("Error removing user %s (UID %d) " | 189 | raise UserManagementError("Error removing user %s (UID %d) " |
310 | 188 | "from group %s (GID (%d).\n%s" | 190 | "from group %s (GID (%d).\n%s" |
Great! +1
#1: config. meta_data_ path config. annotations_ path
os.mkdir( meta_data_ dir)
create_ file(os. path.join( meta_data_ dir, "juju-env-uuid"), "uuid1")
create_ file(os. path.join( meta_data_ dir, "juju-unit-name"), "unit/0")
- meta_data_dir = self.monitor.
+ meta_data_dir = self.monitor.
I'd s/test_ meta_data/ test_annotation s/ for those tests, and s/meta_ data_dir/ annotations_ dir/.
Also it'd be nice to use generic key/values, not juju info specifically, as we're going to push them in a different message.