2020-09-25 08:01:17 +02:00
|
|
|
####################################################################
|
|
|
|
# WARNING: These are designed specifically for Ansible tests #
|
|
|
|
# and should not be used as examples of how to write Ansible roles #
|
|
|
|
####################################################################
|
|
|
|
|
2020-06-03 09:00:07 +02:00
|
|
|
# Test code for iso_create module
|
2022-08-05 12:28:29 +02:00
|
|
|
# Copyright (c) 2020, Diane Wang (Tomorrow9) <dianew@vmware.com>
|
|
|
|
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
|
|
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
2020-06-03 09:00:07 +02:00
|
|
|
- name: install pycdlib
|
|
|
|
pip:
|
|
|
|
name: pycdlib
|
|
|
|
# state: latest
|
2022-06-21 14:12:21 +02:00
|
|
|
extra_args: "-c {{ remote_constraints }}"
|
2020-06-03 09:00:07 +02:00
|
|
|
register: install_pycdlib
|
|
|
|
- debug: var=install_pycdlib
|
|
|
|
|
|
|
|
- set_fact:
|
2021-09-09 07:31:44 +02:00
|
|
|
output_test_dir: '{{ remote_tmp_dir }}/test_iso_create'
|
2020-06-03 09:00:07 +02:00
|
|
|
|
|
|
|
# - include_tasks: prepare_dest_dir.yml
|
|
|
|
|
2021-09-09 07:31:44 +02:00
|
|
|
- name: Copy files and directories
|
|
|
|
copy:
|
|
|
|
src: '{{ item }}'
|
|
|
|
dest: '{{ remote_tmp_dir }}/{{ item }}'
|
|
|
|
loop:
|
|
|
|
- test1.cfg
|
|
|
|
- test_dir
|
|
|
|
|
2020-06-03 09:00:07 +02:00
|
|
|
- name: Test check mode
|
|
|
|
iso_create:
|
|
|
|
src_files:
|
2021-09-09 07:31:44 +02:00
|
|
|
- "{{ remote_tmp_dir }}/test1.cfg"
|
|
|
|
dest_iso: "{{ output_test_dir }}/test.iso"
|
2020-06-03 09:00:07 +02:00
|
|
|
interchange_level: 3
|
|
|
|
register: iso_result
|
2023-02-15 22:55:23 +01:00
|
|
|
check_mode: true
|
2020-06-03 09:00:07 +02:00
|
|
|
- debug: var=iso_result
|
|
|
|
|
|
|
|
- name: Check if iso file created
|
|
|
|
stat:
|
2021-09-09 07:31:44 +02:00
|
|
|
path: "{{ output_test_dir }}/test.iso"
|
2020-06-03 09:00:07 +02:00
|
|
|
register: iso_file
|
|
|
|
- debug: var=iso_file
|
|
|
|
- assert:
|
|
|
|
that:
|
2021-05-22 13:51:36 +02:00
|
|
|
- iso_result is changed
|
2020-06-03 09:00:07 +02:00
|
|
|
- iso_file.stat.exists == False
|
|
|
|
|
|
|
|
- name: Create iso file with a specified file
|
|
|
|
iso_create:
|
|
|
|
src_files:
|
2021-09-09 07:31:44 +02:00
|
|
|
- "{{ remote_tmp_dir }}/test1.cfg"
|
|
|
|
dest_iso: "{{ output_test_dir }}/test.iso"
|
2020-06-03 09:00:07 +02:00
|
|
|
interchange_level: 3
|
|
|
|
register: iso_result
|
|
|
|
- debug: var=iso_result
|
|
|
|
|
|
|
|
- name: Check if iso file created
|
|
|
|
stat:
|
2021-09-09 07:31:44 +02:00
|
|
|
path: "{{ output_test_dir }}/test.iso"
|
2020-06-03 09:00:07 +02:00
|
|
|
register: iso_file
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
2021-05-22 13:51:36 +02:00
|
|
|
- iso_result is changed
|
2020-06-03 09:00:07 +02:00
|
|
|
- iso_file.stat.exists == True
|
|
|
|
|
|
|
|
- name: Create iso file with a specified file and folder
|
|
|
|
iso_create:
|
|
|
|
src_files:
|
2021-09-09 07:31:44 +02:00
|
|
|
- "{{ remote_tmp_dir }}/test1.cfg"
|
|
|
|
- "{{ remote_tmp_dir }}/test_dir"
|
|
|
|
dest_iso: "{{ output_test_dir }}/test1.iso"
|
2020-06-03 09:00:07 +02:00
|
|
|
interchange_level: 3
|
|
|
|
register: iso_result
|
|
|
|
- debug: var=iso_result
|
|
|
|
|
|
|
|
- name: Check if iso file created
|
|
|
|
stat:
|
2021-09-09 07:31:44 +02:00
|
|
|
path: "{{ output_test_dir }}/test1.iso"
|
2020-06-03 09:00:07 +02:00
|
|
|
register: iso_file
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
2021-05-22 13:51:36 +02:00
|
|
|
- iso_result is changed
|
2020-06-03 09:00:07 +02:00
|
|
|
- iso_file.stat.exists == True
|
|
|
|
|
2021-05-22 13:51:36 +02:00
|
|
|
- name: Create iso file with volume identification string
|
2020-06-03 09:00:07 +02:00
|
|
|
iso_create:
|
|
|
|
src_files:
|
2021-09-09 07:31:44 +02:00
|
|
|
- "{{ remote_tmp_dir }}/test1.cfg"
|
|
|
|
dest_iso: "{{ output_test_dir }}/test2.iso"
|
2020-06-03 09:00:07 +02:00
|
|
|
vol_ident: "OEMDRV"
|
|
|
|
register: iso_result
|
|
|
|
- debug: var=iso_result
|
|
|
|
|
|
|
|
- name: Check if iso file created
|
|
|
|
stat:
|
2021-09-09 07:31:44 +02:00
|
|
|
path: "{{ output_test_dir }}/test2.iso"
|
2020-06-03 09:00:07 +02:00
|
|
|
register: iso_file
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
2021-05-22 13:51:36 +02:00
|
|
|
- iso_result is changed
|
2020-06-03 09:00:07 +02:00
|
|
|
- iso_file.stat.exists == True
|
|
|
|
|
2022-07-08 23:11:57 +02:00
|
|
|
- name: Create iso file with Rock Ridge extension
|
2020-06-03 09:00:07 +02:00
|
|
|
iso_create:
|
|
|
|
src_files:
|
2021-09-09 07:31:44 +02:00
|
|
|
- "{{ remote_tmp_dir }}/test1.cfg"
|
|
|
|
dest_iso: "{{ output_test_dir }}/test3.iso"
|
2020-06-03 09:00:07 +02:00
|
|
|
rock_ridge: "1.09"
|
|
|
|
register: iso_result
|
|
|
|
- debug: var=iso_result
|
|
|
|
|
|
|
|
- name: Check if iso file created
|
|
|
|
stat:
|
2021-09-09 07:31:44 +02:00
|
|
|
path: "{{ output_test_dir }}/test3.iso"
|
2020-06-03 09:00:07 +02:00
|
|
|
register: iso_file
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
2021-05-22 13:51:36 +02:00
|
|
|
- iso_result is changed
|
2020-06-03 09:00:07 +02:00
|
|
|
- iso_file.stat.exists == True
|
|
|
|
|
2022-07-08 23:11:57 +02:00
|
|
|
- name: Create iso file with Joliet extension
|
2020-06-03 09:00:07 +02:00
|
|
|
iso_create:
|
|
|
|
src_files:
|
2021-09-09 07:31:44 +02:00
|
|
|
- "{{ remote_tmp_dir }}/test1.cfg"
|
|
|
|
dest_iso: "{{ output_test_dir }}/test4.iso"
|
2020-06-03 09:00:07 +02:00
|
|
|
joliet: 3
|
|
|
|
register: iso_result
|
|
|
|
- debug: var=iso_result
|
|
|
|
|
|
|
|
- name: Check if iso file created
|
|
|
|
stat:
|
2021-09-09 07:31:44 +02:00
|
|
|
path: "{{ output_test_dir }}/test4.iso"
|
2020-06-03 09:00:07 +02:00
|
|
|
register: iso_file
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
2021-05-22 13:51:36 +02:00
|
|
|
- iso_result is changed
|
2020-06-03 09:00:07 +02:00
|
|
|
- iso_file.stat.exists == True
|
|
|
|
|
|
|
|
- name: Create iso file with UDF enabled
|
|
|
|
iso_create:
|
|
|
|
src_files:
|
2021-09-09 07:31:44 +02:00
|
|
|
- "{{ remote_tmp_dir }}/test1.cfg"
|
|
|
|
dest_iso: "{{ output_test_dir }}/test5.iso"
|
2023-03-06 23:02:24 +01:00
|
|
|
udf: true
|
2020-06-03 09:00:07 +02:00
|
|
|
register: iso_result
|
|
|
|
- debug: var=iso_result
|
|
|
|
|
|
|
|
- name: Check if iso file created
|
|
|
|
stat:
|
2021-09-09 07:31:44 +02:00
|
|
|
path: "{{ output_test_dir }}/test5.iso"
|
2020-06-03 09:00:07 +02:00
|
|
|
register: iso_file
|
|
|
|
|
|
|
|
- assert:
|
|
|
|
that:
|
2021-05-22 13:51:36 +02:00
|
|
|
- iso_result is changed
|
2020-06-03 09:00:07 +02:00
|
|
|
- iso_file.stat.exists == True
|