Change the dpkg -l to dpkg-query -s

The dpkg -l python will give 0 as result, because the python has un
(not-installed)status on xenial, switch to dpkg-query will give the
right status code(1) if the package is not installed.

Change-Id: I7faf1d922bdf0673d5daeec6fb2538f1786cbcd1
This commit is contained in:
Weezer Su 2017-01-26 10:20:16 -06:00
parent f48e76ae67
commit e410759e8d

View File

@ -36,7 +36,7 @@
exit $result;
;;
ubuntu)
dpkg -l python
dpkg-query -s python $> /dev/null
result=$?
if [ $result -eq 1 ]; then
@ -48,6 +48,7 @@
;;
esac
changed_when: "result.rc == 2"
failed_when: "{{ result.rc not in [0, 2] }}"
- name: Basic host setup
hosts: "{{ openstack_host_group|default('hosts') }}"