From 970e479c48d5946ac5c3005f6a9945622d0a0f1c Mon Sep 17 00:00:00 2001 From: Lance Bragstad Date: Wed, 27 Nov 2019 07:22:49 -0600 Subject: [PATCH] Use length to avoid unsupported operations with '>' The dev_install.yaml script breaks when running python 3 because of unsupported comparisions between 'AnsibleUnsafeText' and 'int' with the '>' operator. This is very similar to a bug opened against ansible upstream [0]. We can fix the issue by using length explicitly, which ensures we're comparing integers to integers since we're dealing with a list. [0] https://github.com/ansible/ansible/issues/50388 Change-Id: I100639982b75c9d345269ba9bf10defb7e96d774 --- tasks/dev_install.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tasks/dev_install.yml b/tasks/dev_install.yml index e170254..e41f4fb 100644 --- a/tasks/dev_install.yml +++ b/tasks/dev_install.yml @@ -33,7 +33,7 @@ args: chdir: "{{ modify_dir_path }}" loop: "{{ refspecs }}" - when: item > 0 + when: item | length > 0 - name: Copy the Python directories into local temp dir command: "/bin/bash dev_install.sh {{ item }}" @@ -42,6 +42,6 @@ args: chdir: "{{ modify_dir_path }}" loop: "{{ python_dir }}" - when: item > 0 + when: item | length > 0 - include_tasks: modify_image.yml