Skip to content

Commit 016b287

Browse files
committed
1. Remove sanity ignore files
2. Fix import issues with requests 3. Remove Beta from readme 4. Addding argument documention 5. Add missing GPLv3 License header
1 parent 0da07ca commit 016b287

File tree

12 files changed

+78
-32
lines changed

12 files changed

+78
-32
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
if [ -f ansible_collections/middleware_automation/common/requirements.txt ]; then
3636
pip install -r ansible_collections/middleware_automation/common/requirements.txt
3737
fi
38-
38+
3939
- name: Create default collection path
4040
run: |
4141
mkdir -p /home/runner/.ansible/

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ To install all the dependencies via galaxy:
4747

4848
## Support
4949

50-
The common collection is a Beta release and for [Technical Preview](https://access.redhat.com/support/offerings/techpreview). If you have any issues or questions related to collection, please don't hesitate to contact us on <Ansible-middleware-core@redhat.com> or open an issue on <https://github.com/ansible-middleware/common/issues>
50+
The common collection is for [Technical Preview](https://access.redhat.com/support/offerings/techpreview). If you have any issues or questions related to collection, please don't hesitate to contact us on <Ansible-middleware-core@redhat.com> or open an issue on <https://github.com/ansible-middleware/common/issues>
5151

5252
## License
5353

galaxy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
namespace: middleware_automation
33
name: common
4-
version: "1.0.0"
4+
version: "1.0.1"
55
readme: README.md
66
authors:
77
- Andrew Block <ablock@redhat.com>

plugins/doc_fragments/jbossnetwork_connection_options.py

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,29 +12,50 @@ class ModuleDocFragment(object):
1212
- Address of the JBoss Network API.
1313
type: str
1414
required: false
15+
default: 'https://jbossnetwork.api.redhat.com'
1516
client_id:
1617
description:
1718
- Client ID associated with to download a product from the JBoss Network API.
1819
- If value not set, will try environment variable C(REDHAT_PRODUCT_DOWNLOAD_CLIENT_ID)
1920
type: str
20-
required: true
21+
required: false
2122
client_secret:
2223
description:
2324
- Client Secret associated with to download a product from the JBoss Network API.
2425
- If value not set, will try environment variable C(REDHAT_PRODUCT_DOWNLOAD_CLIENT_SECRET)
2526
type: str
26-
required: true
27+
required: false
2728
sso_url:
2829
description:
2930
- Address of the Red Hat SSO Server.
3031
type: str
3132
required: false
33+
default: 'https://sso.redhat.com'
3234
validate_certs:
3335
description:
3436
- If C(false), SSL certificates will not be validated.
3537
type: bool
3638
default: yes
3739
required: false
38-
40+
product_category:
41+
description:
42+
- Type of the Product Category
43+
type: str
44+
required: false
45+
product_id:
46+
description:
47+
- Product Id for the Redhat customer portal
48+
type: str
49+
required: false
50+
product_type:
51+
description:
52+
- Type of the Product
53+
type: str
54+
required: false
55+
product_version:
56+
description:
57+
- Product Version to be downloaded.
58+
type: str
59+
required: false
3960
4061
"""

plugins/module_utils/args_common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
client_secret=dict(no_log=True, required=False),
2727
api_url=dict(required=False, default=JBOSS_NETWORK_API_URL),
2828
sso_url=dict(required=False, default=REDHAT_SSO_URL),
29-
validate_certs=dict(required=False, default=True, type=bool)
29+
validate_certs=dict(required=False, default=True, type='bool')
3030
)
3131

3232
JBOSS_NETWORK_SEARCH_ARGS_SPEC = dict(

plugins/module_utils/jbossnetwork.py

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@
1616

1717
__metaclass__ = type
1818

19-
import requests
19+
try:
20+
import requests
21+
HAS_REQUESTS = True
22+
except ImportError:
23+
HAS_REQUESTS = False
2024

2125
from ansible_collections.middleware_automation.common.plugins.module_utils.constants import (
2226
QUERY_PAGE_SIZE,
@@ -45,9 +49,10 @@ def get_authenticated_session(module, sso_url, validate_certs, client_id, client
4549
}
4650

4751
# Obtain Access Token
48-
token_request = requests.post(
49-
f"{sso_url}/auth/realms/redhat-external/protocol/openid-connect/token",
50-
data=token_request_data, verify=validate_certs)
52+
if HAS_REQUESTS:
53+
token_request = requests.post(
54+
f"{sso_url}/auth/realms/redhat-external/protocol/openid-connect/token",
55+
data=token_request_data, verify=validate_certs)
5156

5257
try:
5358
token_request.raise_for_status()
@@ -57,11 +62,12 @@ def get_authenticated_session(module, sso_url, validate_certs, client_id, client
5762
access_token = token_request.json()["access_token"]
5863

5964
# Setup Session
60-
session = requests.Session()
61-
session.headers = {
62-
"Authorization": f"Bearer {access_token}",
63-
"Content-Type": "application/json",
64-
}
65+
if HAS_REQUESTS:
66+
session = requests.Session()
67+
session.headers = {
68+
"Authorization": f"Bearer {access_token}",
69+
"Content-Type": "application/json",
70+
}
6571

6672
return session
6773

plugins/modules/product_download.py

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,21 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
# This file is part of Ansible
16+
#
17+
# Ansible is free software: you can redistribute it and/or modify
18+
# it under the terms of the GNU General Public License as published by
19+
# the Free Software Foundation, either version 3 of the License, or
20+
# (at your option) any later version.
21+
#
22+
# Ansible is distributed in the hope that it will be useful,
23+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
24+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25+
# GNU General Public License for more details.
26+
#
27+
# You should have received a copy of the GNU General Public License
28+
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
29+
1530
from __future__ import absolute_import, division, print_function
1631

1732
__metaclass__ = type
@@ -32,13 +47,15 @@
3247
dest:
3348
description:
3449
- Absolute .
35-
type: path
50+
type: str
3651
required: true
3752
force:
3853
description:
3954
- If C(true) and C(dest) is not a directory, will download the file every
4055
time and replace the file if the contents change. If C(false), the file
4156
will only be downloaded if the destination does not exist.
57+
default: False
58+
type: bool
4259
"""
4360

4461

@@ -149,7 +166,7 @@ def argspec():
149166
argument_spec = copy.deepcopy(JBOSS_NETWORK_COMMON_ARGS_SPEC)
150167
argument_spec.update(copy.deepcopy(JBOSS_NETWORK_SEARCH_ARGS_SPEC))
151168
argument_spec["dest"] = dict(required=True)
152-
argument_spec["force"] = dict(required=False, default=False, type=bool)
169+
argument_spec["force"] = dict(required=False, default=False, type='bool')
153170

154171
return argument_spec
155172

plugins/modules/product_search.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,21 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
# This file is part of Ansible
16+
#
17+
# Ansible is free software: you can redistribute it and/or modify
18+
# it under the terms of the GNU General Public License as published by
19+
# the Free Software Foundation, either version 3 of the License, or
20+
# (at your option) any later version.
21+
#
22+
# Ansible is distributed in the hope that it will be useful,
23+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
24+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25+
# GNU General Public License for more details.
26+
#
27+
# You should have received a copy of the GNU General Public License
28+
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
29+
1530
from __future__ import absolute_import, division, print_function
1631

1732
__metaclass__ = type
@@ -143,7 +158,7 @@ def argspec():
143158
def main():
144159
module = AnsibleModule(
145160
argument_spec=argspec(),
146-
add_file_common_args=True
161+
add_file_common_args=False
147162
)
148163

149164
if not HAS_REQUESTS:

tests/sanity/ignore-2.11.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

tests/sanity/ignore-2.12.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)