Skip to content

Commit fb0b788

Browse files
committed
Add minimum mas-devops python version check
1 parent 440c46a commit fb0b788

File tree

3 files changed

+35
-2
lines changed

3 files changed

+35
-2
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
required_ansible_version: 2.10.3
2+
required_mas_devops_python_version: 7.1.0
Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,36 @@
1-
- name: Verify minimum Ansible version is {{ required_ansible_version }}
1+
---
2+
# 1. Check minimum Ansible version
3+
# -----------------------------------------------------------------------------
4+
- name: "Verify minimum Ansible version is {{ required_ansible_version }}"
25
assert:
36
that: "ansible_version.full is version_compare(required_ansible_version, '>=')"
47
fail_msg: "This collection is only supported on Ansible version {{ required_ansible_version }} or greater, your current Ansible version is {{ ansible_version.full }}"
8+
9+
10+
# 2. Check minimum mas-devop python package version
11+
# -----------------------------------------------------------------------------
12+
- name: "Check if mas-devops package is installed and meets minimum version"
13+
command: pip show mas-devops
14+
register: mas_devops_package_info
15+
changed_when: false
16+
failed_when: false
17+
18+
- name: "Get installed version of mas-devops"
19+
when: mas_devops_package_info.stdout != ""
20+
set_fact:
21+
mas_devops_version: "{{ mas_devops_package_info.stdout | regex_search('Version: (.+)', '\\1', multiline=True) }}"
22+
23+
- name: "Verify minimum mas-devops is installed"
24+
assert:
25+
that:
26+
- mas_devops_version is defined
27+
- mas_devops_version != ""
28+
fail_msg: "The mas-devops python package is not installed."
29+
30+
- name: "Verify minimum mas-devops version is {{ required_mas_devops_python_version }}"
31+
assert:
32+
that:
33+
- mas_devops_version is defined
34+
- mas_devops_version[0] is defined
35+
- mas_devops_version[0] is version_compare(required_mas_devops_python_version, '>=')
36+
fail_msg: "The version of mas-devops python package installed is too old (minimum version is {{ required_mas_devops_python_version }})."

ibm/mas_devops/roles/suite_app_install/tasks/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@
113113
delay: "{{ mas_app_install_delay }}"
114114
until:
115115
- app_cr_result.resources is defined
116-
- app_cr_result.resources is not None
116+
- app_cr_result.resources is not none
117117
- app_cr_result.resources | length > 0
118118
- app_cr_result.resources | json_query('[*].status.conditions[?type==`Ready`][].status') | select ('match','True') | list | length == 1
119119

0 commit comments

Comments
 (0)