new_module: Modify new_module and templates for Ansible 2.14

ansible-test with ansible-2.14 is adding a lot of new tests to ensure
that the documentation section and the agument spec is complete.

To aid the creation of new_modules that follow these rules, the
'new_module' script and its templates were modified to use the new
ansible-test rules. The 'new_module' script now requires a new
argument, github_user, and the code templates provide the required
fields (like 'type' and 'elements') to the provide examples.
This commit is contained in:
Rafael Guterres Jeffman
2022-10-04 17:55:34 -03:00
parent 1bf7fb7233
commit 9a8d756ad6
5 changed files with 44 additions and 23 deletions

View File

@@ -26,7 +26,7 @@ topdir="$(dirname "$0")"
function usage() {
cat <<EOF
Usage: $prog [options] <module name> <author name> <author email address>
Usage: $prog [options] <module name> <author name> <author email address> <github_user>
Create new ansible-freeipa module using templates.
@@ -71,12 +71,14 @@ fi
name=$1
author=$2
email=$3
github_user=$4
year=$(date +"%Y")
if [ -z "$name" ] || [ -z "$author" ] || [ -z "$email" ]; then
if [ -z "$name" ] || [ -z "$author" ] || [ -z "$email" ] || [ -z "$github_user" ]; then
[ -z "$name" ] && echo "ERROR: name is not valid"
[ -z "$author" ] && echo "ERROR: author is not valid"
[ -z "$email" ] && echo "ERROR: email is not valid"
[ -z "$githubuser" ] && echo "ERROR: github_user is not valid"
echo
usage;
exit 1;
@@ -143,6 +145,7 @@ function template() {
-e "s/\${name^}/${name^}/g" \
-e "s/\$author/$author/g" \
-e "s/\$email/$email/" \
-e "s/\$github/$github_user/" \
-e "s/\$year/$year/" \
"$topdir/templates/$s" > "$d"
}