Issue #4068
closedpulp-admin in cron : "IOError: [Errno 25] Inappropriate ioctl for device"
Description
Hi,
When I try to run `pulp-admin rpm repo list --summary` in cron I have this traceback
2018-10-08 09:34:02,279 - INFO - Response body :
[
{
.............. The json that seems to be OK
}
]
2018-10-08 09:34:02,280 - ERROR - Client-side exception occurred
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/pulp/client/extensions/core.py", line 474, in run
exit_code = Cli.run(self, args)
File "/usr/lib/python2.7/site-packages/okaara/cli.py", line 974, in run
exit_code = command_or_section.execute(self.prompt, remaining_args)
File "/usr/lib/python2.7/site-packages/pulp/client/extensions/extensions.py", line 210, in execute
return self.method(*arg_list, **clean_kwargs)
File "/usr/lib/python2.7/site-packages/pulp/client/commands/repo/cudl.py", line 331, in run
self.display_repository_summaries(**kwargs)
File "/usr/lib/python2.7/site-packages/pulp/client/commands/repo/cudl.py", line 395, in display_repository_summaries
_default_summary_view(repo_list, self.prompt)
File "/usr/lib/python2.7/site-packages/pulp/client/commands/repo/cudl.py", line 520, in _default_summary_view
terminal_width = prompt.terminal_size()[0]
File "/usr/lib/python2.7/site-packages/okaara/prompt.py", line 379, in terminal_size
ioctl = fcntl.ioctl(0, termios.TIOCGWINSZ, struct.pack('HHHH', 0, 0, 0, 0))
IOError: [Errno 25] Inappropriate ioctl for device
Updated by Poil about 6 years ago
It seems that ookara does not have a fallback if no terminal, for example, pexpect have : https://pexpect.readthedocs.io/en/3.x/_modules/pexpect.html
Updated by Poil about 6 years ago
I've patch `/usr/lib/python2.7/site-packages/pulp/client/commands/repo/cudl.py` with a try except, that do the job
# The model being followed for this view is `yum repolist`. That command
# will always show the full ID without truncating. Any remaining space is
# left for the name (sort of; they have a status column that isn't relevant
# here).
try:
terminal_width = prompt.terminal_size()[0]
except:
terminal_width = 80
line_template = '%s %s'
Updated by dkliban@redhat.com about 6 years ago
Thank you for reporting this issue. Could you please submit a PR?
1. Fork pulp repository
2. Write your patch
3. Write appropriate commit message[0]
4. Push your changes to github
5. open pull request against 2-master branch
[0] https://docs.pulpproject.org/en/2.17/nightly/dev-guide/contributing/branching.html#commit-messages
Updated by daviddavis about 6 years ago
- Status changed from NEW to POST
- Assignee set to Poil
Added by Benjamin DUPUIS about 6 years ago
Updated by Anonymous about 6 years ago
- Status changed from POST to MODIFIED
Applied in changeset pulp|99ee3ad578d767d7be50d8cb5dbdfc532241b087.
Updated by ttereshc almost 6 years ago
- Status changed from 5 to CLOSED - CURRENTRELEASE
Fix pulp-admin error when not running in tty
fixes #4068 https://pulp.plan.io/issues/4068