saltstack/salt — pull request #7977 by pakdel (2013-10-19 07:50:30+00:00)
Title: Fix pkg.installed regression and deadlock on subprocess.Popen.poll()

- I was trying to install aaa.noarch on an x86_64 system.
Execution of `salt \* pkg.check_db aaa` will result in the following:
`_pkg_arch('aaa')` returns `['aaa', 'x86_64']`; therefore, in `check_db` (line 396) `x.arch == pkgarch` will be false

Execution of `salt \* pkg.check_db aaa.noarch` will result in the following:
`_pkg_arch('aaa.noarch')` returns `['aaa.noarch', 'noarch']`; therefore, in `check_db` (line 395) `yumbase.searchPackages(('name', 'arch'), ('aaa.noarch',))` will be an empty dictionary

Consequently, I could not install aaa.noarch!

- According to [doc. of Popen](http://docs.python.org/2/library/subprocess.html#subprocess.Popen.poll) a deadlock is produces when there is enough output to the pipe, which was happening when I was bootstrapping a minion from git using Salt-Cloud, which uses salt.utils.nb_popen to execute SSH coomands:
`def root_cmd(command, tty, sudo, **kwargs)` in `saltcloud/utils/__init__.py` uses `proc = NonBlockingPopen(...` which is defined at the bottom of `saltcloud/utils/nb_popen.py`: `from salt.utils.nb_popen import NonBlockingPopen as SaltNonBlockingPopen`