Merge ~ajorgens/cloud-init:simpletable into cloud-init:master
| Status: | Merged |
|---|---|
| Approved by: | Chad Smith on 2017-10-02 |
| Approved revision: | 46732a3706e83685ce494e74bac93cae2259e0c2 |
| Merged at revision: | f010594beb75e146091db47b7d72d1fc1d763e98 |
| Proposed branch: | ~ajorgens/cloud-init:simpletable |
| Merge into: | cloud-init:master |
| Diff against target: |
304 lines (+168/-16) 8 files modified
cloudinit/config/cc_ssh_authkey_fingerprints.py (+2/-2) cloudinit/netinfo.py (+4/-4) cloudinit/simpletable.py (+62/-0) cloudinit/tests/test_simpletable.py (+100/-0) packages/pkg-deps.json (+0/-3) requirements.txt (+0/-3) tools/build-on-freebsd (+0/-1) tox.ini (+0/-3) |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Server Team CI bot | continuous-integration | Approve on 2017-09-21 | |
| Chad Smith | 2017-09-11 | Approve on 2017-09-21 | |
| Andrew Jorgensen (community) | Approve on 2017-09-18 | ||
|
Review via email:
|
|||
Commit Message
Remove prettytable dependency, introduce simpletable
The first revision of this rendered tables with less decoration but there was a desire upstream to avoid possibly breaking some parsing someone might be doing, so it has been revised to render the same as prettytable for the cases cloud-init actually uses.
Description of the Change
Remove prettytable dependency, introduce simpletable
simpletable has no external dependencies and very little complexity.
| Andrew Jorgensen (ajorgens) wrote : | # |
| Andrew Jorgensen (ajorgens) wrote : | # |
Here's an example of netinfo output from a console log:
```
ci-info: +++++++
ci-info: Device Up Address Mask Hw-Address
ci-info: lo True 127.0.0.1 255.0.0.0 .
ci-info: eth0 True 172.31.9.66 255.255.240.0 0a:bc:31:2b:2b:7f
ci-info: +++++++
ci-info: Route Destination Gateway Genmask Interface Flags
ci-info: 0 0.0.0.0 172.31.0.1 0.0.0.0 eth0 UG
ci-info: 1 169.254.169.254 0.0.0.0 255.255.255.255 eth0 UH
ci-info: 2 172.31.0.0 0.0.0.0 255.255.240.0 eth0 U
```
| Andrew Jorgensen (ajorgens) wrote : | # |
Launchpad is collapsing spaces in the above comment, so it's useless in showing what it actually looks like. Sorry.
PASSED: Continuous integration, rev:69951f18fe4
https:/
Executed test runs:
SUCCESS: Checkout
SUCCESS: Unit & Style Tests
SUCCESS: Ubuntu LTS: Build
SUCCESS: Ubuntu LTS: Integration
SUCCESS: MAAS Compatability Testing
IN_PROGRESS: Declarative: Post Actions
Click here to trigger a rebuild:
https:/
| Scott Moser (smoser) wrote : | # |
Andrew, wrt useless of launchpad collapsing spaces, you can put it into a
pastebin http://
You dont remove the dep from requirements.txt here, so it probably ends
up still being a dep at least in ubuntu
I'd like to drop prettytable or at very least make it a soft dependency,
falling back to your simpletable if it wasnt there.
There is an issue.. though. We were using pretty table to render human
friendly output to the /dev/console. The expectation was that that was
human friendly, but since we were not rendering any *machine* friendly
representation of said data, its possible or likely that machines
were parsing that.
I'd like to have an actual solution for writing machine-friendly
data somewhere that we could depend on. And then i woudlnt care so much
about the user-friendly text changing.
This cleary isn't your fault, but I'm just kind of adverse to changing
something that kind of worked and possibly breaking someone without
putting somethign else in place that could be relied upon.
| Andrew Jorgensen (ajorgens) wrote : | # |
We've been using this in Amazon Linux since early 2014 and not once have we heard a complaint, or even a mention of it. I think the worry that someone is parsing routing data out of console output is probably baseless, since that data is better obtained through queries against your cloud APIs if you are outside the instance, or through OS utilities or syscalls if you are inside the instance.
FWIW, the format produced by simpletable is *more* machine readable than the output of prettytable (and prettier, if you ask me and you don't remove any spaces).
Up to you. Amazon will likely continue to carry this patch.
I'll update with a removal from requirements.txt sometime. We had removed it from our RPM .spec file and I forgot it would need to be removed elsewhere.
| Andrew Jorgensen (ajorgens) wrote : | # |
Okay, I went ahead and made its output look like PrettyTable (even if I'm unhappy about that), stripped out every reference to PrettyTable from the code (including requirements.txt, etc.), and wrote some unit tests that assert that the output is the same as PrettyTable for cases actually used in cloud-init.
| Andrew Jorgensen (ajorgens) wrote : | # |
I think I set the state wrong, setting it back to what I actually think of this.
FAILED: Continuous integration, rev:0a3b64acdd0
https:/
Executed test runs:
SUCCESS: Checkout
FAILED: Unit & Style Tests
Click here to trigger a rebuild:
https:/
| Andrew Jorgensen (ajorgens) wrote : | # |
Ugh, how embarrassing. I tried to suppress some flake8 errors and did it so wrong.
| Andrew Jorgensen (ajorgens) wrote : | # |
Okay, latest push should do it. 🤞
PASSED: Continuous integration, rev:37383e5d99f
https:/
Executed test runs:
SUCCESS: Checkout
SUCCESS: Unit & Style Tests
SUCCESS: Ubuntu LTS: Build
SUCCESS: Ubuntu LTS: Integration
SUCCESS: MAAS Compatability Testing
IN_PROGRESS: Declarative: Post Actions
Click here to trigger a rebuild:
https:/
| Andrew Jorgensen (ajorgens) wrote : | # |
> PASSED: Continuous integration, rev:37383e5d99f
Yay!
| Chad Smith (chad.smith) wrote : | # |
Approving pending discussion on inline comments. We probably won't land this until post 17.1 release because the change in dependencies might need a bit more testing on other platforms.
- 46732a3... by Chad Smith on 2017-09-21
| Andrew Jorgensen (ajorgens) wrote : | # |
Pulled in Chad's suggestions.
| Andrew Jorgensen (ajorgens) wrote : | # |
(diff comment replies)
PASSED: Continuous integration, rev:46732a3706e
https:/
Executed test runs:
SUCCESS: Checkout
SUCCESS: Unit & Style Tests
SUCCESS: Ubuntu LTS: Build
SUCCESS: Ubuntu LTS: Integration
SUCCESS: MAAS Compatability Testing
IN_PROGRESS: Declarative: Post Actions
Click here to trigger a rebuild:
https:/


Noticed a mention of PrettyTable in the podcast Scott mentioned on the mailing list, so I thought I'd better post what Amazon Linux uses in place of PrettyTable.
No unit tests written yet, but hopefully I'll be able to take some time to do that soon.
This is an Amazon contribution, not an individual contribution, but I got permission from the original author anyway.