summaryrefslogtreecommitdiff
path: root/test/integration/targets/dnf/tasks
diff options
context:
space:
mode:
authorToshio Kuratomi <a.badger@gmail.com>2017-01-05 00:24:20 -0800
committerToshio Kuratomi <a.badger@gmail.com>2017-01-05 00:24:20 -0800
commitcd2516bf8dbf9c1f90ef0452c207363f14bd8374 (patch)
tree34556002177502a248b62862b51dc3f093be0077 /test/integration/targets/dnf/tasks
parentb73ddd5212c274f9bbe423d1f9ac61a64f3db10e (diff)
downloadansible-cd2516bf8dbf9c1f90ef0452c207363f14bd8374.tar.gz
Revert "Revert "Add --installroot to YUM and DNF modules, issue #11310""
This reverts commit b73ddd5212c274f9bbe423d1f9ac61a64f3db10e.
Diffstat (limited to 'test/integration/targets/dnf/tasks')
-rw-r--r--test/integration/targets/dnf/tasks/dnf.yml30
-rw-r--r--test/integration/targets/dnf/tasks/dnfinstallroot.yml47
-rw-r--r--test/integration/targets/dnf/tasks/main.yml4
3 files changed, 81 insertions, 0 deletions
diff --git a/test/integration/targets/dnf/tasks/dnf.yml b/test/integration/targets/dnf/tasks/dnf.yml
index b381334086..d37f5ed882 100644
--- a/test/integration/targets/dnf/tasks/dnf.yml
+++ b/test/integration/targets/dnf/tasks/dnf.yml
@@ -210,3 +210,33 @@
assert:
that:
- non_existent_rpm|failed
+
+# Install in installroot='/'. This should be identical to default
+- name: install sos in /
+ dnf: name=sos state=present installroot='/'
+ register: dnf_result
+
+- name: check sos with rpm in /
+ shell: rpm -q sos --root=/
+ failed_when: False
+ register: rpm_result
+
+- debug: var=dnf_result
+- debug: var=rpm_result
+
+- name: verify installation of sos in /
+ assert:
+ that:
+ - "not dnf_result.failed | default(False)"
+ - "dnf_result.changed"
+ - "rpm_result.rc == 0"
+
+- name: verify dnf module outputs in /
+ assert:
+ that:
+ - "'changed' in dnf_result"
+ - "'results' in dnf_result"
+
+- name: uninstall sos in /
+ dnf: name=sos installroot='/'
+ register: dnf_result
diff --git a/test/integration/targets/dnf/tasks/dnfinstallroot.yml b/test/integration/targets/dnf/tasks/dnfinstallroot.yml
new file mode 100644
index 0000000000..1cd2a21be6
--- /dev/null
+++ b/test/integration/targets/dnf/tasks/dnfinstallroot.yml
@@ -0,0 +1,47 @@
+# make a installroot
+- name: Create installroot
+ local_action:
+ module: command mktemp -d "{{ lookup('env', 'TMPDIR') | default('/tmp', true) }}/ansible.test.XXXXXX"
+ register: dnfroot
+
+- name: Make a necessary directory
+ file:
+ path: "/{{ dnfroot.stdout }}/etc/dnf/vars/"
+ state: directory
+ mode: 0755
+
+- name: Populate directory
+ copy:
+ content: "{{ ansible_distribution_version }}\n"
+ dest: "/{{ dnfroot.stdout }}/etc/dnf/vars/releasever"
+
+# This will drag in > 200 MB.
+- name: attempt installroot
+ dnf: name=sos installroot="/{{ dnfroot.stdout }}/" disable_gpg_check=yes
+ register: dnf_result
+
+- name: check sos with rpm in installroot
+ shell: rpm -q sos --root="/{{ dnfroot.stdout }}/"
+ failed_when: False
+ register: rpm_result
+
+- debug: var=dnf_result
+- debug: var=rpm_result
+
+- name: verify installation of sos in installroot
+ assert:
+ that:
+ - "not dnf_result.failed | default(False)"
+ - "dnf_result.changed"
+ - "rpm_result.rc == 0"
+
+- name: verify dnf module outputs in /
+ assert:
+ that:
+ - "'changed' in dnf_result"
+ - "'results' in dnf_result"
+
+- name: cleanup installroot
+ file:
+ path: "/{{ dnfroot.stdout }}/"
+ state: absent
diff --git a/test/integration/targets/dnf/tasks/main.yml b/test/integration/targets/dnf/tasks/main.yml
index 755c807e7d..4a9addb573 100644
--- a/test/integration/targets/dnf/tasks/main.yml
+++ b/test/integration/targets/dnf/tasks/main.yml
@@ -18,5 +18,9 @@
# Note: We install the yum package onto Fedora so that this will work on dnf systems
# We want to test that for people who don't want to upgrade their systems.
+
- include: 'dnf.yml'
when: (ansible_distribution in ['RedHat', 'CentOS', 'ScientificLinux'] and False) or (ansible_distribution in ['Fedora'] and ansible_distribution_major_version >= 23)
+
+- include: 'dnfinstallroot.yml'
+ when: (ansible_distribution in ['RedHat', 'CentOS', 'ScientificLinux'] and False) or (ansible_distribution in ['Fedora'] and ansible_distribution_major_version >= 23)