Commit Graph

48 Commits

Author SHA1 Message Date
Thomas Woerner
6ffc51a75f utils/build-galaxy-release.sh: Use proper variable for galaxify
A wrong variable was used inside of the while IFS read loops. This
prevented that the modules, playbooks, tasks, example playbooks and also
tests have been adapted for the galaxy release naming scheme.
2021-01-18 14:19:41 +01:00
Eric Nothen
7bbb401b9b Enabled Ansible check_mode
Added code to the ipa* plugins to support Ansible's check_mode, by
means of a clean exit before the execution of the actual list of
commands that would otherwise create/update/delete IPA servers
and/or its resources.
2021-01-06 12:18:35 +01:00
Thomas Woerner
eba38e30a3 Merge pull request #466 from rjeffman/utils_fix_covscan_findings_lint_check
covscan error[SC2068]: Fix unquoted array expansions.
2020-12-10 09:56:16 +01:00
Rafael Guterres Jeffman
bc4564876b Merge pull request #465 from t-woerner/gen_module_docs_fix_covsvan_findings
utils/gen_modules_docs.sh: Fix covscan findings
2020-12-09 13:21:38 -03:00
Rafael Guterres Jeffman
cef733eba2 covscan error[SC2068]: Fix unquoted array expansions.
error[SC2068]: Double quote array expansions to avoid re-splitting elements.
2020-12-09 13:13:52 -03:00
Rafael Guterres Jeffman
85bd3f5f20 Merge pull request #464 from t-woerner/new_module_fix_covsvan_findings
utils/new_module: Fix covscan findings
2020-12-09 12:16:14 -03:00
Thomas Woerner
0cfc9d0147 utils/gen_modules_docs.sh: Fix covscan findings
error[SC2148]: Tips depend on target shell and yours is unknown.
  Add a shebang.
2020-12-09 16:02:08 +01:00
Thomas Woerner
18c195b052 utils/new_module: Fix covscan findings
warning[SC2166]: Prefer [ p ] || [ q ] as [ p -o q ] is not well
  defined.
2020-12-09 15:57:42 +01:00
Thomas Woerner
c0321b433b utils/build-galaxy-release.sh: Fix covscan findings
warning[SC2044]: For loops over find output are fragile. Use find -exec
  or a while read loop.
warning[SC2164]: Use 'cd ... || exit' or 'cd ... || return' in case cd
  fails.
2020-12-09 15:44:54 +01:00
Rafael Guterres Jeffman
06d73ba8df Merge pull request #460 from t-woerner/build-galaxy-release_args
utils/build-galaxy-release.sh: Fix default namespace and collection name
2020-11-30 12:09:37 -03:00
Thomas Woerner
4d6023207e utils/build-galaxy-release.sh: Fix default namespace and collection name
The default namespace and collection name was not set due to using ":"
instead of "-" while setting the variables internally.
2020-11-30 16:05:58 +01:00
Thomas Woerner
dff485cb7e utils/changelog: Fix get_commit to use proper variable
The function get_commit was using the global merge variable instead of
the local commit variable. Therefore it returned the wrong commit
subject for merges without subject.
2020-11-30 15:51:33 +01:00
Thomas Woerner
d4fbbdfb34 ansible-doc-test: Ignore unhandled paths
Currently the script is failing with The given path '...' is not valid
if a path is not handled by the script. This is resulting in issues if
module_utils and action plugins are updated for example.

The solution is to simply ignore paths that are not handled.
2020-11-25 14:30:04 +01:00
Rafael Guterres Jeffman
18d90c70b3 ansible-doc-test: Ignore role if library directory does not exist.
This change make ansible-doc-test skip processing a role if it does
not contain a `library` directory.
2020-11-17 13:53:10 -03:00
Thomas Woerner
9b86034525 Support namespace and name in utils/build-galaxy-release.sh as args
The currently used namespace and collection name are hard coded in
utils/build-galaxy-release.sh. They can now be defined as args 1 and 2
and default to freeipa and ansible_freeipa..
2020-11-17 14:47:28 +01:00
Rafael Guterres Jeffman
9abc92ed29 Merge pull request #431 from t-woerner/fix_utils_changelog
Fix utils/changelog for merge commits without subject
2020-11-13 16:10:22 -03:00
Thomas Woerner
f45b7d9db0 build-galaxy-release: Galaxyfy READMEs, module EXAMPLES and tests
Up to now the snippets in the README files, the EXAMPLES in the modules
and also the tests playbooks have not been adapted while building the
collection.

These are the invoved python files:

    utils/galaxyfy-README.py
    utils/galaxyfy-module-EXAMPLES.py
    utils/galaxyfy-playbook.py
    utils/galaxyfy.py

utils/galaxyfy.py provides the function galaxyfy_playbook, which has been
extended and is used in galaxyfy-playbook.py, galaxyfy-README.py and
galaxyfy-module-EXAMPLES.py.
2020-11-13 15:59:45 +01:00
Thomas Woerner
2dbbcce517 Fix utils/changelog for merge commits without subject
There is curently a merge commit without a subject, which leads into a
traceback in the changelog script.

The merge information provides the commit hash, which is now used to get
the subject later on using the generated commits hash.
2020-11-09 12:41:01 +01:00
Rafael Guterres Jeffman
698bd81475 Merge pull request #416 from t-woerner/new_changelog_script
New script utils/changelog
2020-10-13 09:34:25 -03:00
Thomas Woerner
f929ad904a New script utils/changelog
This scrip can be used to generate the changelog text for a new
ansible-freeipa release on github.

    usage: Usage: changelog [options] [<new version>]

    optional arguments:
      -h, --help  show this help message and exit
      --tag TAG   git tag

If the script is used without a givn tag, it will show all the changes since
the last tag. If a tag (this can be a also a commit) is given, then all
changes since this commit are shown.
2020-10-08 15:27:26 +02:00
Thomas Woerner
6fb491028e New script utils/ansible-doc-test
This script can check modules in roles and also plugins folder to have
a valid documentation section. It is using anisble-doc internally.

    usage: Usage: ansible-doc-test [options] [path]

    optional arguments:
      -h, --help  show this help message and exit
      -v          increase output verbosity

There are different verbose levels:

    -v   Shows the modules that are tested at the moment.
    -vv  Shows the modules and also the doc output.

You can use the script to check specific modules, roles or modules in roles.
Here are some examples:

Test specific module with verbose level 1:
    $ utils/ansible-doc-test -vv plugins/modules/ipauser.py

Test all modules in plugins folder:
    $ utils/ansible-doc-test -v plugins

Test ipaserver_prepare.py in ipaserver role:
    $ utils/ansible-doc-test -v roles/ipaserver/library/ipaserver_prepare.py

Test all modules in ipaserver role:
    $ utils/ansible-doc-test -v roles/ipaserver

Test all roles:
    $ utils/ansible-doc-test -v roles

Test all roles and modules in plugins:
    $ utils/ansible-doc-test -v
2020-10-08 13:32:11 +02:00
Thomas Woerner
cf4c590303 ipa[server,replica,client]: Drop deactivated Python2/3 test
These tests have been deactivated for some time with b51397e and are
removed now.
2020-09-08 14:44:39 +02:00
Rafael Guterres Jeffman
b7900f1c64 Add script to run linters.
The scprit `lint_check.sh` under utils runs the same linters as the
Github Actions, with the same configuration.

The changes on setup.cfg are required if flake8-docstrings is used,
so its output is the same as pydocstlye.
2020-09-01 17:47:32 -03:00
Rafael Guterres Jeffman
3b32f27508 Merge pull request #348 from t-woerner/new_module_utils_script
New utils script to generate new modules using templates
2020-08-21 16:05:57 -03:00
Thomas Woerner
5fa81a437b New utils script to generate new modules using templates
The script will create the module in plugins/modules, the README, test and
playbook files.

Usage: new_module [options] <module name> <author name>
       <author email address>

Create new ansible-freeipa module using templates.

Options:
  -m          Create module with member support
  -f          Force creation
  -h          Print this help

Example:

    utils/new_module -m permission "My Name" myname@some.email
2020-08-21 18:09:32 +02:00
Thomas Woerner
0395f4136f New script utils/build-srpm.sh to build SRPM
This script gets version and release from git describe --tags. It uses
utils/ansible-freeipa.spec.in and the variables to generate
ansible-freeipa.spec in the top folder.

An archive not including the spec file is created to generate the SRPM from.
2020-08-21 17:55:53 +02:00
Thomas Woerner
3a37325a36 galaxyfy-playbook.py: Fixed script name
The old name was galaxyify-playbook.py instead of galaxyfy-playbook.py
2020-04-02 14:46:54 +02:00
Thomas Woerner
57d407f15f utils/*galaxy*: Make galaxy scripts more generic
The namespace and colleciton name have been hard coded. Now variables are
used for them. The project prefix and collection prefix are now passed to
galaxyify-playbook.py.
2020-04-02 11:26:32 +02:00
Thomas Woerner
a972beb484 ipaserver docs: Calm down module linter
The use of "default: idstart+199999" in the description of the idmax
parameter was resulting in the galaxy import error:

  Cannot parse "DOCUMENTATION": mapping values are not allowed here in
  "<unicode string>", line 52, column 58: ... value for the IDs range
  (default: idstart+199999)

The ":" has simply been removed to fix this issue.
2020-03-30 15:01:55 +02:00
Thomas Woerner
50a1c2f9cd utils/build-galaxy-release: Do not add release tag to version for galaxy
Galaxy does not like the use of the extra "-1" release tag.

Fixes: #236 (Can't install via Galaxy)
2020-03-30 14:45:02 +02:00
Thomas Woerner
b719b1afeb utils/build-galaxy-release.sh: Use ansible-galaxy instead of mazer
ansible-galaxy needs to be used to build the Ansible collection. mazer should
not be used any more.
2019-12-13 22:38:01 +01:00
Thomas Woerner
6ad82e6bc7 ipaclient: Fix misspelled sssd options
The sssd options in the ipaclient role missed a 's' in the role. The readme
of the role used the proper names with 3 's'. The names in the role have
been fixed and if the old setting are used, they will be used in the first
place.

Also utils/ansible-ipa-client-install has been adaped to use the proper
option names now.

This fixes issue #145 (The ipaclient role misspells sssd)
2019-11-20 12:26:29 +01:00
Thomas Woerner
f4680ceb5a utils/ansible-ipa-[server,replica,client]-install: New --ansible-verbose option
This option defines the verbose level for the internal ansible-playbook
run.
2019-08-15 21:29:03 +02:00
Thomas Woerner
3a3fb51109 utils/ansible-ipa-server-install: Add deprecated (unused) --domain-level option
This is option is used in test scripts.
2019-08-15 17:32:42 +02:00
Thomas Woerner
1d5b5d38b7 utils/ansible-ipa-[server,replica,client]-install: New --become-method option
This option is the same as the --become-method option with ansible-playbook.
If this option is set, become_method will be set in the generated playbook.
2019-08-06 12:42:21 +02:00
Thomas Woerner
d43b4429e6 utils/ansible-ipa-[server,replica,client]-install: Print excessive args
Excessive args are printed now. The simple print of the message too many
arguments was not helping.
2019-08-06 12:39:03 +02:00
Thomas Woerner
45af7348fe utils/ansible-ipa-[server,replica,client]-install: Add p.wait() for returncode
The p.wait() call has been missing in the normal case, therefore no proper
returncode has been returned.
2019-08-06 11:32:55 +02:00
Thomas Woerner
b636ab3112 utils/ansible-ipa-[server,replica,client]-install: New --playbook-dir option
If the --playbook-dir option is used, the inventory and playbook files will
be generated in this directory. The files will not be removed after the
playbook processing ended.

If the directory does not exist an error message will be printed and the
utility will not continue.
2019-08-06 09:17:59 +02:00
Thomas Woerner
ab25078b47 ansible-ipa-*-install: Get continuous output working for python2 also
The used code for continuous output from the ansible-playbook call was
only working for Python2. The output has only been printed when the command
finised. This code has been replaced with code that is working with Python2
and Python3.
2019-07-29 13:03:24 +02:00
Thomas Woerner
781ac6e90b ansible-ipa-client-install: The proper option is ipaclient-install-packages
The wrong name has been used for the option of _install_packages.
2019-07-29 13:02:30 +02:00
Thomas Woerner
5179514e0c ansible-ipa-*-install: Use /usr/bin/python by default, fix _install_packages
/usr/bin/python should be used by default. Fixed typo in _install_packages
setting in the inventory file.
2019-07-29 12:33:25 +02:00
Thomas Woerner
203735e143 Utils scripts: ansible-ipa-[server,replica,client]-install
These are utils scripts to do a server,replica or client deployment and
undeployment using the ansible roles. A client inventory and playbook is
generated by the script which is then used with ansible-playbook.

The command line options or the normal command line installers
ipa-server-install, ipa-replica-install and ipa-client-install are all
supported also by these scripts.

Additonally to the commadn line of the normal installers it is needed to
add the fqdn of the host to be installed.

It is needed that the ansible-freeipa roles are available and also usable
by ansible.
2019-07-29 11:57:51 +02:00
Thomas Woerner
515f57eb09 utils/galaxyify-playbook.py: Support to galaxify rule lines in playbooks 2019-07-24 19:21:51 +02:00
Thomas Woerner
62097ee368 utils/[galaxyify-playbook,gen_module_docs].py: flake8 fixes 2019-07-24 19:21:48 +02:00
Thomas Woerner
0240ec34a5 utils/build-galaxy-release.sh: Fix module_utils import in management modules
The prefix has been fixed in the wrong files.
2019-07-23 17:01:05 +02:00
Thomas Woerner
5790f4a703 utils/gen_module_docs.py: Drop parameter name dirserv_cert_files
This parameter name is not used and therefore not needed anymore.
2019-07-23 16:58:17 +02:00
Thomas Woerner
5dd5faccb0 New utils script to update module docs
Usage: sh utils/gen_modules_docs.sh
2019-07-23 10:01:59 +02:00
Thomas Woerner
040d95c519 utils/build-galaxy-release.sh: New build script for galaxy release
This script will to the following steps:

- Fix the galaxy release in galaxy.yml
- Remove emacs backup files
- Link module_utils, modules and action_plugins from roles to plugins/..
- Fix import prefix for module_utils
- Fix module prefixes in playbooks and example playbooks
- Build release using mazer
- Clean up again
2019-07-23 10:00:27 +02:00