glance client should check for input file when running commands with interactive prompts

Bug #884116 reported by Nikolay Sokolov on 2011-10-31
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ken Thomas

Bug Description

Client does not detects that his STDOUT and STDIN are not in terminal and asks questions anyway, this is unexpected behavior and may cause bugs for people using it in scripts.

[root@gm SL61]# glance index < /dev/urandom > test.txt
[root@gm SL61]# cat test.txt
ID Name Disk Format Container Format Size
---------------- ------------------------------ -------------------- -------------------- --------------
15 SL61 ami ami 216858624
14 cloudpipe_SL61 ami ami 259981312
13 SL61_kernel aki aki 3881936
12 SL61_ramdisk ari ari 12511144
11 SL61 ami ami 216858624
10 cloudpipe_SL61 ami ami 259981312
9 SL61_kernel aki aki 3881936
8 SL61_ramdisk ari ari 12511144
7 rhel56 ami ami 160383488
6 rhel56_kernel aki aki 2094684
Fetch next page? [Y/n] [root@gm SL61]#

Jay Pipes (jaypipes) on 2011-10-31
Changed in glance:
status: New → Confirmed
importance: Undecided → Low
summary: - glance client does not detect running not in terminal
+ glance client should check for input file when running commands with
+ interactive prompts
Ken Thomas (krt) wrote :

This looks like a nice easy one to dip my toes in.

Changed in glance:
assignee: nobody → Ken Thomas (krt)

Fix proposed to branch: master

Changed in glance:
status: Confirmed → In Progress
Ken Thomas (krt) wrote :

Second checking added me to Authors file. Still looking into what to do on Windows w.r.t. istty

Ken Thomas (krt) wrote :

I haven't been able to test the latest change on Windows, but from what I've been reading. using sys.stdin.isatty should work.

Submitter: Jenkins
Branch: master

commit 4ef665a7cc1af14814f9cade3768b64447a6542f
Author: Ken Thomas <email address hidden>
Date: Thu Mar 1 13:09:23 2012 -0800

    Glance skip prompting if stdin isn't a tty

    Don't have glance issue prompts if stdin isn't a tty. Fixes bug 884116.

    In glance's user_confirm routine, check if stdin is a tty and if
    not, just return the default value. If it is a tty, then continue
    with the raw_input call to issue the prompt and get the response.
    Latest patch includes recommended change to check for isatty attr before
    using it.

    Added myself to Authors.

    Change-Id: I8134668b8382b44618c86972190f3d7d98f55e52

Changed in glance:
status: In Progress → Fix Committed
Thierry Carrez (ttx) on 2012-03-21
Changed in glance:
milestone: none → essex-rc1
status: Fix Committed → Fix Released
Thierry Carrez (ttx) on 2012-04-05
Changed in glance:
milestone: essex-rc1 → 2012.1
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers