Fix idempotence of infrared scenario

- configure infrared to reuse default scenario config:
  - use containers for testing infrared code
  - disable idempotence check for entire scenario
- resolve deprecation warning with pip package call (items)
- removed cleanup as is not needed with containers

Change-Id: I20b418e4038b42f359813774884e51b80805b112
This commit is contained in:
Sorin Sbarnea
2020-02-19 10:59:40 +00:00
parent e2bccc1bb1
commit 91bdae6b2a
4 changed files with 16 additions and 46 deletions

View File

@@ -21,6 +21,7 @@ provisioner:
interpreter_python: auto
forks: 50
stdout_callback: yaml
timeout: 30
ssh_connection:
pipelining: true
inventory:
@@ -29,6 +30,8 @@ provisioner:
local_working_dir: "{{ lookup('env', 'TOX_ENV_DIR') or '~/.cache' }}/log"
artcl_gzip: true
artcl_min_size: 500000 # ~0.5mb
infrared_location: "~/.venv"
infrared_venv: "{{ infrared_location }}/.infrared"
verifier:
name: ansible
lint:

View File

@@ -1,29 +0,0 @@
---
- name: Cleanup
hosts: all
tasks:
- name: Ansible check file exists example.
stat:
path: "{{ infrared_venv }}/bin/activate"
register: former_venv
- name: "Uninstall ansible-role-collect-logs plugin"
shell: |
export PATH=$PATH:/usr/local/sbin:/usr/sbin
source {{ infrared_venv }}/bin/activate
ir plugin remove ansible-role-collect-logs
ir plugin list
args:
executable: /bin/bash
register: plugin_uninstall_output
when: former_venv.stat.exists
- name: "Debug, plugin uninstallation"
debug:
msg: "{{ plugin_uninstall_output }}"
- name: "Clean Infrared venv"
file:
path: "{{ infrared_location }}"
state: absent

View File

@@ -1 +1 @@
../sova/molecule.yml
../default/molecule.yml

View File

@@ -12,45 +12,41 @@
- name: "Create Infrared venv"
pip:
name: "{{ item }}"
name:
- pbr
- pip
- setuptools
virtualenv: "{{ infrared_venv }}"
with_items:
- pip
- setuptools
- pbr
- name: "Install Infrared"
pip:
name: "."
virtualenv: "{{ infrared_venv }}"
chdir: "{{ infrared_location }}"
tags:
# this task is always changed, the problem is on pip module side:
# https://github.com/ansible/ansible/issues/28952
- molecule-idempotence-notest
- name: "Create infrared_plugin dir"
file:
path: "{{ infrared_location }}/infrared_plugin"
state: directory
- name: "Copy ansible-role-collect-logs to test host"
synchronize:
src: "{{ playbook_dir }}/../../"
dest: "{{ ansible_env.HOME }}/artcl-src"
rsync_opts:
- "--exclude=.tox"
- name: "Install ansible-role-collect-logs plugin"
shell: |
export PATH=$PATH:/usr/local/sbin:/usr/sbin
source {{ infrared_venv }}/bin/activate
ir plugin add {{ playbook_dir }}/../../ --src-path infrared_plugin
ir plugin add {{ ansible_env.HOME }}/artcl-src --src-path infrared_plugin
args:
chdir: "{{ infrared_location }}"
executable: /bin/bash
register: plugin_install_output
changed_when: true
tags:
# the task is always changed, skip idempotence
- molecule-idempotence-notest
- name: "Debug: output from plugin installation task main playbook"
debug:
msg: "{{ plugin_install_output }}"
tags:
# the task depends on a taks which skips idempotence
- molecule-idempotence-notest