Skip to content

Commit 87207f4

Browse files
authored
Merge pull request #122 from ansible-collections/release-v1.3.0-beta.1
Merge `release-v1.3.0-beta.1` branch back into `dev` after release.
2 parents 34347fb + 58e85b6 commit 87207f4

File tree

72 files changed

+1345
-1865
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+1345
-1865
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ application deployment in one easy-to-use platform.
2727
community supported.
2828

2929
For **guides** and **reference**, please visit [the documentation
30-
site](https://ansible-collections.github.io/ibm_zos_ims/).
30+
site](https://ibm.github.io/z_ansible_collections_doc/index.html).
3131

3232
Features
3333
========
@@ -40,7 +40,7 @@ and ansible-doc to automate tasks on IMS.
4040
Ansible version compatibility
4141
==============================
4242

43-
This collection has been tested against the following Ansible versions: >=2.9,<=2.14.1.
43+
This collection has been tested against the following Ansible versions: >=2.14.0,<2.16.0.
4444

4545

4646
Copyright

docs/Makefile

Lines changed: 60 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,11 @@ SPHINXBUILD ?= sphinx-build
99
SOURCEDIR = source
1010
BUILDDIR = build
1111
ROOT_DIR:=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
12+
OS_DISTRO := $(shell uname)
13+
INDEX_HTML = build/html/index.html
1214
line_header="===================================================================="
1315

14-
15-
view-html:
16-
@echo "Display generated HTML in default browser."
17-
@open build/html/index.html
16+
.PHONY: help Makefile
1817

1918
# Put it first so that "make" without argument is like "make help".
2019
help:
@@ -48,7 +47,19 @@ help:
4847
@echo $(line_header)
4948
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
5049

51-
.PHONY: help Makefile
50+
view-html:
51+
ifeq ($(shell test -e $(INDEX_HTML) && echo true),true)
52+
@echo "Display generated HTML '$(INDEX_HTML)' in default browser."
53+
ifeq ($(OS_DISTRO), Darwin)
54+
@open build/html/index.html
55+
else ifeq ($(OS_DISTRO), Linux)
56+
@xdg-open build/html/index.html &> /dev/null &
57+
else
58+
@echo "Unable to launch browser for $(INDEX_HTML), open file with your browser."
59+
endif
60+
else
61+
@echo "Unable to find generated HTML '$(INDEX_HTML)'."
62+
endif
5263

5364
clean:
5465
@echo $(line_header)
@@ -98,16 +109,16 @@ role-doc:
98109
fi
99110

100111
@for role_name in `ls ../roles/`; do \
101-
echo "Detected role name $$role_name"; \
102-
if test -e ../roles/$$role_name/docs/doc_$$role_name; then \
103-
echo "Copying metadata ../roles/$$role_name/docs/doc_$$role_name to ../roles/$$role_name/docs/doc_$$role_name.py"; \
104-
cp ../roles/$$role_name/docs/doc_$$role_name ../roles/$$role_name/docs/doc_$$role_name.py; \
105-
echo "Sanitizing metadata ../roles/$$role_name/docs/doc_$$role_name.py"; \
106-
sed -i "" "s/role:/module:/g" ../roles/$$role_name/docs/doc_$$role_name.py; \
107-
echo "Generating RST doc for role ../roles/$$role_name"; \
108-
ansible-doc-extractor --template templates/role.rst.j2 source/roles ../roles/$$role_name/docs/doc_$$role_name.py; \
109-
echo "Deleting generated metadata ../roles/$$role_name/docs/doc_$$role_name.py"; \
110-
rm -rf ../roles/$$role_name/docs/doc_$$role_name.py; \
112+
echo "Detected role name $$role_name"; \
113+
if test -e ../roles/$$role_name/docs/doc_$$role_name; then \
114+
echo "Copying metadata ../roles/$$role_name/docs/doc_$$role_name to ../roles/$$role_name/docs/doc_$$role_name.py"; \
115+
cp ../roles/$$role_name/docs/doc_$$role_name ../roles/$$role_name/docs/doc_$$role_name.py; \
116+
echo "Sanitizing metadata ../roles/$$role_name/docs/doc_$$role_name.py"; \
117+
sed -i -e "s/^role:/module:/" ../roles/$$role_name/docs/doc_$$role_name.py; \
118+
echo "Generating RST doc for role ../roles/$$role_name"; \
119+
ansible-doc-extractor --template templates/role.rst.j2 source/roles ../roles/$$role_name/docs/doc_$$role_name.py; \
120+
echo "Deleting generated metadata ../roles/$$role_name/docs/doc_$$role_name.py"; \
121+
rm -rf ../roles/$$role_name/docs/doc_$$role_name.py; \
111122
fi; \
112123
done
113124

@@ -130,40 +141,49 @@ module-doc:
130141
mkdir -p source/modules; \
131142
fi
132143

133-
@if ! test -d ../plugins/modules/rexx_module_doc; then \
134-
echo "Make ../plugins/modules/rexx_module_doc directory to extract REXX doc into temporary file."; \
135-
mkdir -p ../plugins/modules/rexx_module_doc; \
136-
else \
137-
echo "Delete ../plugins/modules/rexx_module_doc directory used to extract REXX doc into temporary file."; \
138-
rm -rf ../plugins/modules/rexx_module_doc; \
139-
echo "Make ../plugins/modules/rexx_module_doc directory to extract REXX doc into temporary file."; \
140-
mkdir -p ../plugins/modules/rexx_module_doc; \
141-
fi
142-
143-
@for rexx_module in `ls ../plugins/modules/*rexx`; do\
144-
REXX_FILE=`basename $$rexx_module .rexx`; \
145-
echo "Extracting documentation for module $$REXX_FILE into ../plugins/modules/rexx_module_doc/$$REXX_FILE.py"; \
146-
touch ../plugins/modules/rexx_module_doc/$$REXX_FILE.py; \
147-
sed -n "/DOCUMENTATION = '''/,/'''/p" ../plugins/modules/$$REXX_FILE.rexx >> ../plugins/modules/rexx_module_doc/$$REXX_FILE.py; \
148-
sed -n "/EXAMPLES = '''/,/'''/p" ../plugins/modules/$$REXX_FILE.rexx >> ../plugins/modules/rexx_module_doc/$$REXX_FILE.py; \
149-
sed -n "/RETURN = '''/,/'''/p" ../plugins/modules/$$REXX_FILE.rexx >> ../plugins/modules/rexx_module_doc/$$REXX_FILE.py; \
150-
echo "Generating ReStructuredText for module $$REXX_FILE inot source/modules/$$REXX_FILE.rst"; \
151-
ansible-doc-extractor --template templates/module.rst.j2 source/modules ../plugins/modules/rexx_module_doc/$$REXX_FILE.py; \
152-
done
153-
154-
@if test -d ../plugins/modules/rexx_module_doc; then \
155-
echo "Delete ../plugins/modules/rexx_module_doc directory used to extract REXX doc into temporary file."; \
156-
rm -rf ../plugins/modules/rexx_module_doc; \
157-
fi
144+
# @if ! test -d ../plugins/modules/rexx_module_doc; then \
145+
# echo "Make ../plugins/modules/rexx_module_doc directory to extract REXX doc into temporary file."; \
146+
# mkdir -p ../plugins/modules/rexx_module_doc; \
147+
# else \
148+
# echo "Delete ../plugins/modules/rexx_module_doc directory used to extract REXX doc into temporary file."; \
149+
# rm -rf ../plugins/modules/rexx_module_doc; \
150+
# echo "Make ../plugins/modules/rexx_module_doc directory to extract REXX doc into temporary file."; \
151+
# mkdir -p ../plugins/modules/rexx_module_doc; \
152+
# fi
153+
154+
# @for rexx_module in `ls ../plugins/modules/*rexx`; do\
155+
# REXX_FILE=`basename $$rexx_module .rexx`; \
156+
# echo "Extracting documentation for module $$REXX_FILE into ../plugins/modules/rexx_module_doc/$$REXX_FILE.py"; \
157+
# touch ../plugins/modules/rexx_module_doc/$$REXX_FILE.py; \
158+
# sed -n "/DOCUMENTATION = '''/,/'''/p" ../plugins/modules/$$REXX_FILE.rexx >> ../plugins/modules/rexx_module_doc/$$REXX_FILE.py; \
159+
# sed -n "/EXAMPLES = '''/,/'''/p" ../plugins/modules/$$REXX_FILE.rexx >> ../plugins/modules/rexx_module_doc/$$REXX_FILE.py; \
160+
# sed -n "/RETURN = '''/,/'''/p" ../plugins/modules/$$REXX_FILE.rexx >> ../plugins/modules/rexx_module_doc/$$REXX_FILE.py; \
161+
# echo "Generating ReStructuredText for module $$REXX_FILE inot source/modules/$$REXX_FILE.rst"; \
162+
# ansible-doc-extractor --template templates/module.rst.j2 source/modules ../plugins/modules/rexx_module_doc/$$REXX_FILE.py; \
163+
# done
164+
165+
# @if test -d ../plugins/modules/rexx_module_doc; then \
166+
# echo "Delete ../plugins/modules/rexx_module_doc directory used to extract REXX doc into temporary file."; \
167+
# rm -rf ../plugins/modules/rexx_module_doc; \
168+
# fi
158169

159170
@if test -e ../plugins/modules/__init__.py; then \
160171
echo "Rename file '../plugins/modules/__init__.py' to ../plugins/modules/__init__.py.skip to avoid reading empty python file.'"; \
161172
mv ../plugins/modules/__init__.py ../plugins/modules/__init__.py.skip; \
162173
fi
163174

175+
@echo "Replacing string based carriage returns with literal escaped to produce sphynx consumable RST."
176+
scripts/pre-template.sh
177+
164178
@echo "Generating ReStructuredText for all ansible modules found at '../plugins/modules/' to 'source/modules'."
165179
@ansible-doc-extractor --template templates/module.rst.j2 source/modules ../plugins/modules/*.py
166180

181+
@echo "Updating zos_apf file."
182+
scripts/post-zos_apf.sh
183+
184+
@echo "Reverting edited source file."
185+
scripts/post-template.sh
186+
167187
@if test -e ../plugins/modules/__init__.py.skip; \
168188
echo "Rename file '../plugins/modules/__init__.py.skip' back to ../plugins/modules/__init__.py.'"; \
169189
then mv -f ../plugins/modules/__init__.py.skip ../plugins/modules/__init__.py; \

docs/ansible_content.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ Ansible® Automation to IBM Z through the offering
1414
The **IBM z/OS IMS collection** supports tasks such as generating
1515
IMS Database Descriptors (DBD), Program Specification Blocks (PSB),
1616
Application Control Blocks (ACB), running IMS commands
17-
(type-1, type-2, DBRC), and interacting with the IMS Catalog.
17+
(type-1, type-2, DBRC), interacting with the IMS Catalog, and
18+
the IMS Data Definition Language Utility (DDL).
1819

1920
The Ansible modules in this collection are written in Python and
2021
interact with the `IBM z/OS core collection`_ and

docs/scripts/auto-doc-gen.sh

Lines changed: 46 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
################################################################################
44
# © Copyright IBM Corporation 2020
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
514
################################################################################
615

716
################################################################################
@@ -16,40 +25,43 @@ DOC_DIR=`( cd "$SCRIPT_PATH" && pwd )| sed 's|\(.*\)/.*|\1|'`
1625
# Source the playbook*.rst into a single RST so that our topic is a single html
1726
################################################################################
1827

19-
# If playbooks-single.rst exists, zero it out so we generate the lastest based
20-
# on the payboook-*.rst files
21-
if [[ -f $DOC_DIR/source/playbooks-single.rst ]]; then
22-
:> $DOC_DIR/source/playbooks-single.rst
23-
fi
24-
25-
# Remove the first toctree entry and onwards from playbooks.rst to create a new
26-
# RST playbooks-single.rst. Note, you should ensure toctree entries are at the
27-
# end of the conent to not remove unwanted content.
28-
if [[ -f $DOC_DIR/source/playbooks.rst ]]; then
29-
30-
# Remove the toctree entries
31-
awk '/toctree/ {exit} {print}' $DOC_DIR/source/playbooks.rst >> $DOC_DIR/source/playbooks-single.rst
32-
33-
# Concat the interested RSTs into playbooks-single.rst to create a single RST
34-
if [[ -f $DOC_DIR/source/playbook_config_setup.rst && -f $DOC_DIR/source/playbook_inventory.rst && -f $DOC_DIR/source/playbook_group_vars.rst && -f $DOC_DIR/source/playbook_run.rst ]]; then
35-
36-
# Inform readers this is auto generated thus avoding the need to maintain
37-
echo ".. ...........................................................................\n$(<$DOC_DIR/source/playbooks-single.rst)" > $DOC_DIR/source/playbooks-single.rst
38-
echo ".. Auto generated restructured text .\n$(<$DOC_DIR/source/playbooks-single.rst)" > $DOC_DIR/source/playbooks-single.rst
39-
echo ".. ...........................................................................\n$(<$DOC_DIR/source/playbooks-single.rst)" > $DOC_DIR/source/playbooks-single.rst
40-
41-
# For each identified file we want to merge into playbooks-single.rst cat them and merge
42-
for file in $DOC_DIR/source/playbook_config_setup.rst $DOC_DIR/source/playbook_inventory.rst $DOC_DIR/source/playbook_group_vars.rst $DOC_DIR/source/playbook_run.rst; do
43-
echo "" >> $DOC_DIR/source/playbooks-single.rst;
44-
cat "$file" >> $DOC_DIR/source/playbooks-single.rst;
45-
done
46-
else
47-
# When unable to merge remove the auto generated RST so that is apparent
48-
# it is not generated and will diff in a 'git status'
49-
50-
rm -rf $DOC_DIR/source/playbooks-single.rst
51-
fi
52-
fi
28+
################################################################################
29+
# Deprecated playbooks-single.rst
30+
# # If playbooks-single.rst exists, zero it out so we generate the lastest based
31+
# # on the payboook-*.rst files
32+
# if [[ -f $DOC_DIR/source/playbooks-single.rst ]]; then
33+
# :> $DOC_DIR/source/playbooks-single.rst
34+
# fi
35+
36+
# # Remove the first toctree entry and onwards from playbooks.rst to create a new
37+
# # RST playbooks-single.rst. Note, you should ensure toctree entries are at the
38+
# # end of the conent to not remove unwanted content.
39+
# if [[ -f $DOC_DIR/source/playbooks.rst ]]; then
40+
41+
# # Remove the toctree entries
42+
# awk '/toctree/ {exit} {print}' $DOC_DIR/source/playbooks.rst >> $DOC_DIR/source/playbooks-single.rst
43+
44+
# # Concat the interested RSTs into playbooks-single.rst to create a single RST
45+
# if [[ -f $DOC_DIR/source/playbook_config_setup.rst && -f $DOC_DIR/source/playbook_inventory.rst && -f $DOC_DIR/source/playbook_group_vars.rst && -f $DOC_DIR/source/playbook_run.rst ]]; then
46+
47+
# # Inform readers this is auto generated thus avoding the need to maintain
48+
# echo ".. ...........................................................................\n$(<$DOC_DIR/source/playbooks-single.rst)" > $DOC_DIR/source/playbooks-single.rst
49+
# echo ".. Auto generated restructured text .\n$(<$DOC_DIR/source/playbooks-single.rst)" > $DOC_DIR/source/playbooks-single.rst
50+
# echo ".. ...........................................................................\n$(<$DOC_DIR/source/playbooks-single.rst)" > $DOC_DIR/source/playbooks-single.rst
51+
52+
# # For each identified file we want to merge into playbooks-single.rst cat them and merge
53+
# for file in $DOC_DIR/source/playbook_config_setup.rst $DOC_DIR/source/playbook_inventory.rst $DOC_DIR/source/playbook_group_vars.rst $DOC_DIR/source/playbook_run.rst; do
54+
# echo "" >> $DOC_DIR/source/playbooks-single.rst;
55+
# cat "$file" >> $DOC_DIR/source/playbooks-single.rst;
56+
# done
57+
# else
58+
# # When unable to merge remove the auto generated RST so that is apparent
59+
# # it is not generated and will diff in a 'git status'
60+
61+
# rm -rf $DOC_DIR/source/playbooks-single.rst
62+
# fi
63+
# fi
64+
################################################################################
5365

5466
# If requirements-single.rst exists, zero it out so we generate the lastest based
5567
# on the requirements-*.rst files

docs/scripts/post-doc-gen.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
################################################################################
44
# © Copyright IBM Corporation 2020
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
514
################################################################################
615

716
################################################################################

docs/scripts/post-template.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/sh
2+
3+
################################################################################
4+
# © Copyright IBM Corporation 2020
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
################################################################################
15+
16+
################################################################################
17+
# This scripts actions called before after generating RST such that the
18+
# original template.py is put back in its original state.
19+
################################################################################
20+
21+
# Obtain the galaxy collection installion up to the template.py located on the host
22+
template_doc_source=`ansible-config dump|grep DEFAULT_MODULE_PATH| cut -d'=' -f2|sed 's/[][]//g' | tr -d \'\" |sed 's/modules/doc_fragments\/template.py/g'`
23+
mv $template_doc_source.tmp $template_doc_source

docs/scripts/pre-doc-gen.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,16 @@
11
#!/bin/sh
22

33
################################################################################
4-
# © Copyright IBM Corporation 2020
4+
# © Copyright IBM Corporation 2023
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
514
################################################################################
615

716
################################################################################

docs/scripts/pre-template.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/sh
2+
3+
################################################################################
4+
# © Copyright IBM Corporation 2023
5+
# Licensed under the Apache License, Version 2.0 (the "License");
6+
# you may not use this file except in compliance with the License.
7+
# You may obtain a copy of the License at
8+
# http://www.apache.org/licenses/LICENSE-2.0
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
################################################################################
15+
16+
################################################################################
17+
# This scripts actions called before generating RST, this scripts leaves the
18+
# "\n", "\r", "\r\n" in the template.py doc_fragment so that ansible linting
19+
# test will pass such that the doc and module are match. Later this script will
20+
# update the above strings to liters with an esacpe, for example "\n" --> '\\n'.
21+
# This allows for RST to be generated that is usable by the ansible-doc-extractor
22+
# and Jinja2 template, and later sphinx html.
23+
# This requries that the ansible collection be prebuilt so that it can find
24+
# the template.py within the collection (not within the git project). Thus run
25+
# './ac --ac-build' before the make file that builds doc.
26+
################################################################################
27+
28+
template_doc_source=`ansible-config dump|grep DEFAULT_MODULE_PATH| cut -d'=' -f2|sed 's/[][]//g' | tr -d \'\" |sed 's/modules/doc_fragments\/template.py/g'`
29+
cp $template_doc_source $template_doc_source.tmp
30+
sed -i '' "s/\"\\\\n\"/'\\\\\\\\n'/g" $template_doc_source
31+
sed -i '' "s/\"\\\\r\"/'\\\\\\\\r'/g" $template_doc_source
32+
sed -i '' "s/\"\\\\r\\\\n\"/'\\\\\\\\r\\\\\\\\n'/g" $template_doc_source

0 commit comments

Comments
 (0)