This repository has been archived by the owner on May 30, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
Refactor version checks #366
Merged
aleksei-burlakov
merged 1 commit into
trento-project:main
from
aleksei-burlakov:refactor-version-checks
Oct 27, 2021
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,8 @@ | ||
--- | ||
|
||
- name: "{{ name }}.check" | ||
shell: | | ||
# | ||
readlink /etc/products.d/baseproduct | grep -i "{{ expected [name] }}" || exit 1 | ||
exit 0 | ||
check_mode: false | ||
register: config_updated | ||
changed_when: config_updated.rc != 0 | ||
failed_when: config_updated.rc > 1 | ||
|
||
- block: | ||
- name: Post results | ||
- name: "{{ name }} Post results" | ||
import_role: | ||
name: post-results | ||
when: | ||
- ansible_check_mode | ||
vars: | ||
status: "{{ config_updated is not changed }}" | ||
status: "{{ ansible_distribution is version(expected[name], '==') }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,8 @@ | ||
--- | ||
|
||
- block: | ||
- name: Post results | ||
- name: "{{ name }} Post results" | ||
import_role: | ||
name: post-results | ||
when: | ||
- ansible_check_mode | ||
vars: | ||
status: "{{ ansible_distribution_version is version(expected[name], '>=') }}" | ||
status: "{{ ansible_distribution_version is version(expected[name], '>=') }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,8 @@ | ||
--- | ||
|
||
- name: "{{ name }}.check" | ||
shell: | | ||
# Check the pacemaker version IS | ||
# If not installed, exit with error | ||
rpm -q --qf "%{VERSION}\n" pacemaker || exit 2 | ||
check_mode: false | ||
register: config_updated | ||
changed_when: config_updated.stdout is version(expected[name], '<') | ||
failed_when: config_updated.rc > 1 | ||
|
||
- block: | ||
- name: Post results | ||
- name: "{{ name }} Post results" | ||
import_role: | ||
name: post-results | ||
when: | ||
- ansible_check_mode | ||
vars: | ||
status: "{{ config_updated is not changed }}" | ||
status: "{{ 'pacemaker' in ansible_facts.packages and ansible_facts.packages['pacemaker'][0].version is version(expected[name], '>=') }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,8 @@ | ||
--- | ||
|
||
- name: "{{ name }}.check" | ||
shell: | | ||
# Check the corosync version IS | ||
# If not installed, exit with error | ||
rpm -q --qf "%{VERSION}\n" corosync || exit 2 | ||
check_mode: false | ||
register: config_updated | ||
changed_when: config_updated.stdout is version(expected[name], '<') | ||
failed_when: config_updated.rc > 1 | ||
|
||
- block: | ||
- name: Post results | ||
- name: "{{ name }} Post results" | ||
import_role: | ||
name: post-results | ||
when: | ||
- ansible_check_mode | ||
vars: | ||
status: "{{ config_updated is not changed }}" | ||
status: "{{ 'corosync' in ansible_facts.packages and ansible_facts.packages['corosync'][0].version is version(expected[name], '>=') }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,8 @@ | ||
--- | ||
|
||
- name: "{{ name }}.check" | ||
shell: | | ||
# Check the sbd version IS | ||
# If not installed, exit with error | ||
rpm -q --qf "%{VERSION}\n" sbd || exit 2 | ||
check_mode: false | ||
register: config_updated | ||
changed_when: config_updated.stdout is version(expected[name], '<') | ||
failed_when: config_updated.rc > 1 | ||
|
||
- block: | ||
- name: Post results | ||
- name: "{{ name }} Post results" | ||
import_role: | ||
name: post-results | ||
when: | ||
- ansible_check_mode | ||
vars: | ||
status: "{{ config_updated is not changed }}" | ||
status: "{{ 'sbd' in ansible_facts.packages and ansible_facts.packages['sbd'][0].version is version(expected[name], '>=') }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,8 @@ | ||
--- | ||
|
||
- name: "{{ name }}.check" | ||
shell: | | ||
# Check the SAPHanaSR version is at least | ||
# If not installed, exit with error | ||
rpm -q --qf "%{VERSION}\n" SAPHanaSR || exit 2 | ||
check_mode: false | ||
register: config_updated | ||
changed_when: config_updated.stdout is version(expected[name], '<') | ||
failed_when: config_updated.rc > 1 | ||
|
||
- block: | ||
- name: Post results | ||
- name: "{{ name }} Post results" | ||
import_role: | ||
name: post-results | ||
when: | ||
- ansible_check_mode | ||
vars: | ||
status: "{{ config_updated is not changed }}" | ||
status: "{{ 'SAPHanaSR' in ansible_facts.packages and ansible_facts.packages['SAPHanaSR'][0].version is version(expected[name], '>=') }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,8 @@ | ||
--- | ||
|
||
- name: "{{ name }}.check" | ||
shell: | | ||
# Check python version | ||
python3 --version | cut -d" " -f2 | ||
check_mode: false | ||
register: config_updated | ||
changed_when: config_updated.stdout is version(expected[name], '<') | ||
failed_when: config_updated.rc !=0 | ||
|
||
- block: | ||
- name: Post results | ||
- name: "{{ name }} Post results" | ||
import_role: | ||
name: post-results | ||
when: | ||
- ansible_check_mode | ||
vars: | ||
status: "{{ config_updated is not changed }}" | ||
status: "{{ 'python3' in ansible_facts.packages and ansible_facts.packages['python3'][0].version is version(expected[name], '>=') }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The python-rpm has other versioning that the suse rpm rpm. It's not 4.14.02 but 0.0.2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mmm, the version
0.0.2
looks a like a placeholder. Maybe we should install usingapt-get install python3-rpm
which would bring the a more maintained version.Anyway, if this works it is fine for me