diff options
author | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2012-11-12 09:02:54 -0500 |
---|---|---|
committer | Chris St. Pierre <chris.a.st.pierre@gmail.com> | 2012-11-12 09:02:54 -0500 |
commit | 5f263d88822324d98350fc660b3ca0b077bd1501 (patch) | |
tree | 2ff874900f4b8fd5c52a19ea0081a6a45aeca068 /src/lib/Bcfg2/Server/Admin/Pull.py | |
parent | 452e6adf697d829e400d61999049afa1a3fb9864 (diff) | |
download | bcfg2-5f263d88822324d98350fc660b3ca0b077bd1501.tar.gz bcfg2-5f263d88822324d98350fc660b3ca0b077bd1501.tar.bz2 bcfg2-5f263d88822324d98350fc660b3ca0b077bd1501.zip |
flush input buffers before accepting stdin
Diffstat (limited to 'src/lib/Bcfg2/Server/Admin/Pull.py')
-rw-r--r-- | src/lib/Bcfg2/Server/Admin/Pull.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/lib/Bcfg2/Server/Admin/Pull.py b/src/lib/Bcfg2/Server/Admin/Pull.py index e41652205..130e85b67 100644 --- a/src/lib/Bcfg2/Server/Admin/Pull.py +++ b/src/lib/Bcfg2/Server/Admin/Pull.py @@ -1,8 +1,10 @@ """ Retrieves entries from clients and integrates the information into the repository """ -import getopt +import os import sys +import getopt +import select import Bcfg2.Server.Admin from Bcfg2.Compat import input # pylint: disable=W0622 @@ -99,6 +101,10 @@ class Pull(Bcfg2.Server.Admin.MetadataCore): else: print(" => host entry: %s" % (choice.hostname)) + # flush input buffer + while len(select.select([sys.stdin.fileno()], [], [], + 0.0)[0]) > 0: + os.read(sys.stdin.fileno(), 4096) ans = input("Use this entry? [yN]: ") in ['y', 'Y'] if ans: return choice |