Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 43 additions & 29 deletions molecule/prod_eap/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,49 @@
- name: Converge
hosts: localhost
gather_facts: no
vars:
client_id: "{{ lookup('env', 'PROD_JBOSSNETWORK_API_CLIENTID') }}"
client_secret: "{{ lookup('env', 'PROD_JBOSSNETWORK_API_SECRET') }}"
tasks:
- name: Search EAP Product
middleware_automation.common.product_search:
client_id: "{{ lookup('env', 'PROD_JBOSSNETWORK_API_CLIENTID') }}"
client_secret: "{{ lookup('env', 'PROD_JBOSSNETWORK_API_SECRET') }}"
product_type: DISTRIBUTION
product_version: '7.4'
product_category: appplatform
register: rhn_products
no_log: false
- name: Execute scenario when production credentials are provided
when:
- client_id is defined and client_id | length > 0
- client_secret is defined and client_secret | length > 0
block:
- name: Search EAP Product
middleware_automation.common.product_search:
client_id: "{{ lookup('env', 'PROD_JBOSSNETWORK_API_CLIENTID') }}"
client_secret: "{{ lookup('env', 'PROD_JBOSSNETWORK_API_SECRET') }}"
product_type: DISTRIBUTION
product_version: '7.4'
product_category: appplatform
register: rhn_products
no_log: false

- name: Search install zipfile
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please remove the trailing spaces.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks, they are now removed.

ansible.builtin.set_fact:
rhn_filtered_products: "{{ rhn_products.results | selectattr('file_path', 'match', '[^/]*/jboss-eap-7.4.0.zip$') }}"

- name: Retrieve product download using JBossNetwork API
middleware_automation.common.product_search:
client_id: "{{ lookup('env', 'PROD_JBOSSNETWORK_API_CLIENTID') }}"
client_secret: "{{ lookup('env', 'PROD_JBOSSNETWORK_API_SECRET') }}"
product_type: BUGFIX
product_version: '7.4'
product_category: appplatform
register: rhn_products
no_log: true

- name: Determine patch versions list
ansible.builtin.set_fact:
filtered_versions: "{{ rhn_products.results | map(attribute='file_path') | select('match', '^[^/]*/jboss-eap-.*[0-9]*[.][0-9]*[.][0-9]*.*$') | map('regex_replace','[^/]*/jboss-eap-([0-9]*[.][0-9]*[.][0-9]*)-.*','\\1' ) | list | unique }}"

- name: Determine latest version
ansible.builtin.debug:
msg: "JBoss EAP 7.4 most recent CP is version {{ filtered_versions | middleware_automation.common.version_sort | last }}"

- name: Search install zipfile
ansible.builtin.set_fact:
rhn_filtered_products: "{{ rhn_products.results | selectattr('file_path', 'match', '[^/]*/jboss-eap-7.4.0.zip$') }}"

- name: Retrieve product download using JBossNetwork API
middleware_automation.common.product_search:
client_id: "{{ lookup('env', 'PROD_JBOSSNETWORK_API_CLIENTID') }}"
client_secret: "{{ lookup('env', 'PROD_JBOSSNETWORK_API_SECRET') }}"
product_type: BUGFIX
product_version: '7.4'
product_category: appplatform
register: rhn_products
no_log: true

- name: Determine patch versions list
ansible.builtin.set_fact:
filtered_versions: "{{ rhn_products.results | map(attribute='file_path') | select('match', '^[^/]*/jboss-eap-.*[0-9]*[.][0-9]*[.][0-9]*.*$') | map('regex_replace','[^/]*/jboss-eap-([0-9]*[.][0-9]*[.][0-9]*)-.*','\\1' ) | list | unique }}"

- name: Determine latest version
- name: Skip message when credentials not provided
ansible.builtin.debug:
msg: "JBoss EAP 7.4 most recent CP is version {{ filtered_versions | middleware_automation.common.version_sort | last }}"
msg: "Skipping EAP prod scenario - set PROD_JBOSSNETWORK_API_CLIENTID and PROD_JBOSSNETWORK_API_SECRET to exercise JBoss Network API tests"
when:
- client_id is not defined or client_id | length == 0 or client_secret is not defined or client_secret | length == 0
61 changes: 0 additions & 61 deletions plugins/doc_fragments/jbossnetwork_connection_options.py

This file was deleted.

53 changes: 51 additions & 2 deletions plugins/modules/product_download.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,58 @@
description:
- Downloads products from the JBoss Network API.
extends_documentation_fragment:
- files
- middleware_automation.common.jbossnetwork_connection_options
- ansible.builtin.files
options:
api_url:
description:
- Address of the JBoss Network API.
type: str
required: false
default: 'https://jbossnetwork.api.redhat.com'
client_id:
description:
- Client ID associated with to download a product from the JBoss Network API.
- If value not set, will try environment variable C(REDHAT_PRODUCT_DOWNLOAD_CLIENT_ID)
type: str
required: false
client_secret:
description:
- Client Secret associated with to download a product from the JBoss Network API.
- If value not set, will try environment variable C(REDHAT_PRODUCT_DOWNLOAD_CLIENT_SECRET)
type: str
required: false
sso_url:
description:
- Address of the Red Hat SSO Server.
type: str
required: false
default: 'https://sso.redhat.com'
validate_certs:
description:
- If C(false), SSL certificates will not be validated.
type: bool
default: yes
required: false
product_category:
description:
- Type of the Product Category
type: str
required: false
product_id:
description:
- Product Id for the Redhat customer portal
type: str
required: false
product_type:
description:
- Type of the Product
type: str
required: false
product_version:
description:
- Product Version to be downloaded.
type: str
required: false
dest:
description:
- Absolute .
Expand Down
53 changes: 51 additions & 2 deletions plugins/modules/product_search.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,57 @@
short_description: Searches products from the JBoss Network API.
description:
- Searches products from the JBoss Network API.
extends_documentation_fragment:
- middleware_automation.common.jbossnetwork_connection_options
options:
api_url:
description:
- Address of the JBoss Network API.
type: str
required: false
default: 'https://jbossnetwork.api.redhat.com'
client_id:
description:
- Client ID associated with to download a product from the JBoss Network API.
- If value not set, will try environment variable C(REDHAT_PRODUCT_DOWNLOAD_CLIENT_ID)
type: str
required: false
client_secret:
description:
- Client Secret associated with to download a product from the JBoss Network API.
- If value not set, will try environment variable C(REDHAT_PRODUCT_DOWNLOAD_CLIENT_SECRET)
type: str
required: false
sso_url:
description:
- Address of the Red Hat SSO Server.
type: str
required: false
default: 'https://sso.redhat.com'
validate_certs:
description:
- If C(false), SSL certificates will not be validated.
type: bool
default: yes
required: false
product_category:
description:
- Type of the Product Category
type: str
required: false
product_id:
description:
- Product Id for the Redhat customer portal
type: str
required: false
product_type:
description:
- Type of the Product
type: str
required: false
product_version:
description:
- Product Version to be downloaded.
type: str
required: false
"""


Expand Down
Loading