New module for cargo command (#3712) (#4011)

* New module for cargo command

* Resolve CI errors

* Update plugins/modules/packaging/language/cargo.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/modules/packaging/language/cargo.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Update plugins/modules/packaging/language/cargo.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Add maintainer

* Change installed_packages from property to function

* Allow cargo to install list of of packages

* Remove period at the end of task names

* Pass only the list of packages to take action on to cargo

* Add integration tests for cargo

* Update plugins/modules/packaging/language/cargo.py

Co-authored-by: Felix Fontein <felix@fontein.de>

* Apply suggestions from code review

* Update tests/integration/targets/cargo/tasks/setup.yml

* Update tests/integration/targets/cargo/tasks/setup.yml

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit 7c21a27c5d)

Co-authored-by: radek-sprta <mail@radeksprta.eu>
This commit is contained in:
patchback[bot] 2022-01-08 16:03:23 +01:00 committed by GitHub
parent a860f537dd
commit 6676fb8fb4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 286 additions and 0 deletions

View file

@ -0,0 +1,3 @@
destructive
shippable/posix/group2
skip/aix

View file

@ -0,0 +1,5 @@
- import_tasks: setup.yml
- block:
- import_tasks: test_general.yml
- import_tasks: test_version.yml
when: has_cargo | default(false)

View file

@ -0,0 +1,14 @@
---
- block:
- name: Install cargo
package:
name: cargo
state: present
- set_fact:
has_cargo: true
when:
- ansible_system != 'FreeBSD' or ansible_distribution_version is version('13.0', '>')
- ansible_distribution != 'MacOSX'
- ansible_distribution != 'RedHat' or ansible_distribution_version is version('8.0', '>=')
- ansible_distribution != 'CentOS' or ansible_distribution_version is version('7.0', '>=')
- ansible_distribution != 'Ubuntu' or ansible_distribution_version is version('18', '>=')

View file

@ -0,0 +1,31 @@
---
- name: Ensure application helloworld is uninstalled
community.general.cargo:
state: absent
name: helloworld
register: uninstall_absent_helloworld
- name: Install application helloworld
community.general.cargo:
name: helloworld
register: install_absent_helloworld
- name: Install application helloworld again
community.general.cargo:
name: helloworld
register: install_present_helloworld
ignore_errors: yes
- name: Uninstall application helloworld
community.general.cargo:
state: absent
name: helloworld
register: uninstall_present_helloworld
- name: Check assertions helloworld
assert:
that:
- uninstall_absent_helloworld is not changed
- install_absent_helloworld is changed
- install_present_helloworld is not changed
- uninstall_present_helloworld is changed

View file

@ -0,0 +1,25 @@
---
- name: Install application helloworld-yliu 0.1.0
community.general.cargo:
name: helloworld-yliu
version: 0.1.0
register: install_helloworld_010
- name: Upgrade helloworld-yliu 0.1.0
community.general.cargo:
name: helloworld-yliu
state: latest
register: upgrade_helloworld_010
- name: Downgrade helloworld-yliu 0.1.0
community.general.cargo:
name: helloworld-yliu
version: 0.1.0
register: downgrade_helloworld_010
- name: Check assertions helloworld-yliu 0.1.0
assert:
that:
- install_helloworld_010 is changed
- upgrade_helloworld_010 is changed
- downgrade_helloworld_010 is changed