Merge lp:~frankban/lpsetup/search-interface2 into lp:lpsetup
Status: | Merged |
---|---|
Approved by: | Gary Poster |
Approved revision: | 27 |
Merged at revision: | 19 |
Proposed branch: | lp:~frankban/lpsetup/search-interface2 |
Merge into: | lp:lpsetup |
Diff against target: | 0 lines |
To merge this branch: | bzr merge lp:~frankban/lpsetup/search-interface2 |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Gary Poster (community) | Approve | ||
Review via email: mp+104521@code.launchpad.net |
Description of the change
== Changes ==
This branch adds to lxcip the ability to search network interfaces.
This is done looking for directories under /proc/[container pid]/root/
Some changes were required to accomplish this:
- changed the ui:
-n [container] returns a list of interfaces found (excluding loopback)
-n [container] -i [interface] just displays the ip address of the given interface
deleted the -s option, no longer required
- added a `get_interfaces` function
- changed `get_ip` (now `get_ip_addresses`) to accept a list of network interfaces and return the corresponding sequence of ip addresses
Other minor fixes:
- tests stopping and restarting lxc are now more robust: the container is correctly restarted if the test fails.
- updated *lpsetup* LXC_IP command to reflect ui changes.
== Tests ==
$ nosetests
.......
Name Stmts Miss Cover Missing
-------
lpsetup 6 1 83% 16
lpsetup.argparser 125 6 95% 113, 221, 278-279, 298, 307
lpsetup.exceptions 6 0 100%
lpsetup.handlers 55 1 98% 55
lpsetup.settings 29 0 100%
lpsetup.subcommands 0 0 100%
lpsetup.utils 130 32 75% 81, 115-125, 140, 191, 201, 222-224, 242-248, 263-264, 276-282
-------
TOTAL 351 40 89%
-------
Ran 56 tests in 0.549s
OK
$ cd lplxcip/ && sudo nosetests
.......
-------
Ran 35 tests in 20.308s
OK
This looks very nice Francesco.
I only have trivial comments.
(1) Maybe test name changes for the new behavior? of_single_ interface (or test_output_ of_explicit_ interface) ? of_all_ interfaces?
test_short -> test_output_
test_verbose -> test_output_
(2) This docstring of the "stopped" contextmanager has one small error (temporary -> temporarily). I'd prefer a rewrite of the second sentence, but some small punctuation changes would improve it.
+ """A context manager to temporary stop the given `obj`.
+
+ Entering this context manager `obj.stop()` is called, while
+ `obj.start()` is invoked exiting.
So, the first sentence should be "A context manager to temporarily stop the given `obj`."
Here's my suggestion for the second sentence: "When entering this context manager, `obj.stop()` is called.
`obj.start()` is invoked when exiting."
Alternatively, this smaller change would be ok: "Entering this context manager, `obj.stop()` is called; while `obj.start()` is invoked exiting."
As an aside, I can't help but have a hunch that the code's structure would have been different had we not started with -s, but I can't see another much better way of doing things, and this is nice and clear, so I have no concerns or suggestions.