mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-22 21:00:22 -07:00
cpanm - revamp module (#2218)
* copying from the previous branch * passing sanity - docs incomplete * adjusted parameter name * adjusted unit tests for mode=new * adjusted integration tests for mode=new * added 'russoz' to list of maintainers for cpanm * Update tests/integration/targets/cpanm/tasks/main.yml * Update tests/integration/targets/cpanm/tasks/main.yml * ensuring backward compatibility + tests * added changelog fragment * version for new parameter and adjusted example * typo and formatting * Update plugins/modules/packaging/language/cpanm.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/packaging/language/cpanm.py Co-authored-by: Felix Fontein <felix@fontein.de> * Update plugins/modules/packaging/language/cpanm.py Co-authored-by: Felix Fontein <felix@fontein.de> * multiple changes - some fixes from PR - supporting tests - integration is no longer unsupported => destructive, should run on apt- and rpm-based systems only * only run integration tests in redhat-family > v7 or debian-family Co-authored-by: Felix Fontein <felix@fontein.de>
This commit is contained in:
parent
721589827e
commit
ec9c23437c
7 changed files with 508 additions and 101 deletions
64
tests/integration/targets/cpanm/tasks/main.yml
Normal file
64
tests/integration/targets/cpanm/tasks/main.yml
Normal file
|
@ -0,0 +1,64 @@
|
|||
# (c) 2020, Berkhan Berkdemir
|
||||
# (c) 2021, Alexei Znamensky
|
||||
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
|
||||
- name: bail out for non-supported platforms
|
||||
meta: end_play
|
||||
when:
|
||||
- (ansible_os_family != "RedHat" or ansible_distribution_major_version|int < 7)
|
||||
- ansible_os_family != "Debian"
|
||||
|
||||
- name: install perl development package for Red Hat family
|
||||
package:
|
||||
name:
|
||||
- perl-devel
|
||||
- perl-App-cpanminus
|
||||
state: present
|
||||
become: yes
|
||||
when: ansible_os_family == "RedHat"
|
||||
|
||||
- name: install perl development package for Debian family
|
||||
package:
|
||||
name:
|
||||
- cpanminus
|
||||
state: present
|
||||
become: yes
|
||||
when: ansible_os_family == "Debian"
|
||||
|
||||
- name: install a Perl package
|
||||
cpanm:
|
||||
name: JSON
|
||||
notest: yes
|
||||
register: install_perl_package_result
|
||||
|
||||
- name: assert package is installed
|
||||
assert:
|
||||
that:
|
||||
- install_perl_package_result is changed
|
||||
- install_perl_package_result is not failed
|
||||
|
||||
- name: install same Perl package
|
||||
cpanm:
|
||||
name: JSON
|
||||
notest: yes
|
||||
register: install_same_perl_package_result
|
||||
|
||||
- name: assert same package is installed
|
||||
assert:
|
||||
that:
|
||||
- install_same_perl_package_result is not changed
|
||||
- install_same_perl_package_result is not failed
|
||||
|
||||
- name: install a Perl package with version operator
|
||||
cpanm:
|
||||
name: JSON
|
||||
version: "@4.01"
|
||||
notest: yes
|
||||
mode: new
|
||||
register: install_perl_package_with_version_op_result
|
||||
|
||||
- name: assert package with version operator is installed
|
||||
assert:
|
||||
that:
|
||||
- install_perl_package_with_version_op_result is changed
|
||||
- install_perl_package_with_version_op_result is not failed
|
Loading…
Add table
Add a link
Reference in a new issue