Bug 1188781
| Summary: | pulp-admin line wrapping makes output difficult to parse | ||
|---|---|---|---|
| Product: | Red Hat Satellite | Reporter: | Frank Hirtz <fhirtz> |
| Component: | Pulp | Assignee: | satellite6-bugs <satellite6-bugs> |
| Status: | CLOSED NOTABUG | QA Contact: | Katello QA List <katello-qa-list> |
| Severity: | low | Docs Contact: | |
| Priority: | low | ||
| Version: | 6.0.0 | CC: | bbuckingham, bkearney, erik-fedora, lpramuk, mhrivnak, pmoravec |
| Target Milestone: | Unspecified | Keywords: | Triaged |
| Target Release: | Unused | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | Doc Type: | Bug Fix | |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2016-10-04 13:48:24 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
| Embargoed: | |||
pulp-admin has harcoded line wrapping at 80 chars even if you redirect output into a file. it ignores terminal settings at all :-/ For the client, I ended up doing this:
wrap_to_terminal = false
wrap_width = 20000
That's hackish, and it ends up with a really long title and dividers (they set the output of those to the width, which doesn't work so well for us here). I hacked in a quick sanity check on those for testing:
<snip>
[root@garabaldi client]# diff -uNr /usr/lib/python2.7/site-packages/pulp/client/extensions/core.py.orig /usr/lib/python2.7/site-packages/pulp/client/extensions/core.py
--- /usr/lib/python2.7/site-packages/pulp/client/extensions/core.py.orig 2014-12-04 13:24:39.095639100 -0500
+++ /usr/lib/python2.7/site-packages/pulp/client/extensions/core.py 2014-12-04 13:33:02.174349751 -0500
@@ -114,9 +114,13 @@
width = self.wrap_width
width = int(math.floor(TITLE_PERCENTAGE * width))
- divider = '+' + ('-' * (width - 2)) + '+'
+ if width > 80:
+ dividerwidth = 78
+ else:
+ dividerwidth = (width - 2)
+ divider = '+' + ('-' * dividerwidth) + '+'
- title = self.center(title, width=width)
+ title = self.center(title, width=dividerwidth)
self.write(divider)
# self.write(title, color=COLOR_HEADER, tag=TAG_TITLE) # removing color for now
</snip>
...but that's just a hack.
The Pulp upstream bug status is at NEW. Updating the external tracker on this bug. The Pulp upstream bug priority is at Normal. Updating the external tracker on this bug. Adding mhrivnak to cc list Adding bbouters to cc list pulp-admin needs a lot of work to make its output machine-parsable. The line wrapping is just one of numerous issues (changing capitalization, incorrect exit codes, etc). Upstream, we would much rather replace pulp-admin completely with a new tool that is less cumbersome to use, and easier for both machines and humans to interact with. There are lots of ideas about this, but I don't anticipate being able to prioritize it until after pulp 3.0. Since pulp-admin is not part of the core product, I suggest making this low priority relative to other satellite requirements. We can do it if necessary, but given a long list of other requirements, I suspect our time is better spent on other areas. *** Bug 1299524 has been marked as a duplicate of this bug. *** Per 6.3 planning, moving out non acked bugs to the backlog We have reported this bug upstream, and will deliver the fix when it is available. Since pulp-admin is not part of the core product, we are not planning on tracking this particular feature. The upstream issue to track the resolution is https://pulp.plan.io/issues/929. |
Description of problem: I don't think that this is unique to pulp-admin, but my report is specifically for that. Anyway, pulp-admin automatically linewraps output, which is pretty, but makes it difficult to parse and make use of the data that it outputs since it's often truncated and completed on multiple lines. Since we use excessively long labels by default, it makes it quite difficult to work with: <snip> [root@garabaldi pulp]# pulp-admin repo list --details | head -n 20 +------------------------------------------------------------------------------+ Repositories +------------------------------------------------------------------------------+ Id: Maunet_org-Red_Hat_Enterprise_Linux_Server-Red_Hat_Enterprise_Linux_6_Serv er_-_Extras_RPMs_x86_64 Display Name: Red Hat Enterprise Linux 6 Server - Extras RPMs x86_64 Description: None Content Unit Counts: Erratum: 4 Rpm: 13 Notes: Importers: Config: Feed: https://cdn.redhat.com/content/dist/rhel/server/6/6Server/x86_64/extras/os SSL CA Cert: -----BEGIN CERTIFICATE----- MIIG/TCCBOWgAwIBAgIBNzANBgkqhkiG9w0BAQUFADCBsTELMAkGA1UEBhMCVVMx FzAVBgNVBAgMDk5vcnRoIENhcm9saW5hMRYwFAYDVQQKDA1SZWQgSGF0LCBJbmMu MRgwFgYDVQQLDA9SZWQgSGF0IE5ldHdvcmsxMTAvBgNVBAMMKFJlZCBIYXQgRW50 aXRsZW1lbnQgT3BlcmF0aW9ucyBBdXRob3JpdHkxJDAiBgkqhkiG9w0BCQEWFWNh ... </snip> This makes human parsing a bit challenging at times and makes automatic parsing of the output quite difficult. It also breaks format of SSL CA Cert keys. One can work around this in an ugly way by specifying: wrap_to_terminal = false wrap_width = <some arbitrary long value longer than the longest field> ...which is unappealing, and also has us create really, really long dividers and the like in our attempt to prettify the output. I put a hack in to limit the dividers to 80 characters, but that's not really a fix. It'd be nice if we could just disable line-wrapping as an option here. Version-Release number of selected component (if applicable): pulp-admin-client-2.4.3-1.el7sat.noarch