openstack-ansible-repo_build/tasks/repo_venv_pre_build.yml
Daniel Gonzalez 851e3ffd09 Remove warning when no base venvs are found
During the "Destroy base venvs to rebuild them" step ansible tries to
access base_venvs.stdout_lines. If no base_venvs have been registered
previously, this causes a deprecation warning because stdout_lines is
undefined.
This is a small fix to remove this warning by giving an empty list as
default value when stdout_lines is not defined.

TrivialFix

Change-Id: I358709f3d4dc10a60f59976f1c4fbf87705def57
2016-10-05 14:10:09 +02:00

60 lines
1.9 KiB
YAML

---
# Copyright 2015, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
- name: Make sure old venv build directories are clean
file:
path: "{{ item }}"
state: "absent"
with_items:
- "{{ repo_build_venv_build_dir }}"
tags:
- repo-create-venv-location
- repo-venv-compress-archive
- repo-create-venv-archive
- name: Register arch base venvs
command: "find {{ repo_build_venv_dir }}/{{ repo_build_release_tag }}/{{ ansible_distribution | lower }}/ -name '*{{ ansible_architecture | lower }}*'"
args:
removes: "{{ repo_build_venv_dir }}/{{ repo_build_release_tag }}/{{ ansible_distribution | lower }}"
register: base_venvs
tags:
- repo-create-venv-location
- repo-venv-compress-archive
- repo-create-venv-archive
- name: Destroy base venvs to rebuild them
file:
path: "{{ item }}"
state: "absent"
with_items: "{{ base_venvs.stdout_lines|default([]) }}"
tags:
- repo-create-venv-location
- repo-venv-compress-archive
- repo-create-venv-archive
- name: Create venv directory
file:
path: "{{ item }}"
state: "directory"
owner: "{{ repo_build_service_user_name }}"
mode: 02755
with_items:
- "{{ repo_build_venv_build_dir }}/venvs"
- "{{ repo_build_venv_dir }}/{{ repo_build_release_tag }}/{{ ansible_distribution | lower }}"
tags:
- repo-create-venv-location
- repo-venv-compress-archive
- repo-create-venv-archive