Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Linux] Check vmtools_log_dir is defined before using in check_os_fullname #498

Merged
merged 2 commits into from
Sep 8, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 28 additions & 23 deletions linux/check_os_fullname/check_os_fullname.yml
Original file line number Diff line number Diff line change
Expand Up @@ -102,29 +102,34 @@
- name: "Test rescue"
include_tasks: ../../common/test_rescue.yml
always:
- name: "Get VMware Tools log directory stat info"
include_tasks: ../utils/get_file_stat_info.yml
vars:
guest_file_path: "{{ vmtools_log_dir }}"

- name: "Collect VMware Tools logs"
when:
- vmtools_log_dir is defined
- vmtools_log_dir
block:
- name: "Archive VMware Tools debug logs"
community.general.archive:
path: "{{ vmtools_log_dir }}"
dest: "{{ vmtools_log_dir }}.tgz"
mode: "0644"
delegate_to: "{{ vm_guest_ip }}"
register: archive_vmtools_logs

- name: "Fetch VMware Tools debug logs"
include_tasks: ../utils/fetch_file.yml
- name: "Get VMware Tools log directory stat info"
include_tasks: ../utils/get_file_stat_info.yml
vars:
fetch_file_src_path: "{{ vmtools_log_dir }}.tgz"
fetch_file_dst_path: "{{ current_test_log_folder }}/"
fetch_file_ignore_errors: true
when:
- archive_vmtools_logs is defined
- archive_vmtools_logs.changed is defined
- archive_vmtools_logs.changed
when: guest_file_exists
guest_file_path: "{{ vmtools_log_dir }}"

- name: "Collect VMware Tools logs"
block:
- name: "Archive VMware Tools debug logs"
community.general.archive:
path: "{{ vmtools_log_dir }}"
dest: "{{ vmtools_log_dir }}.tgz"
mode: "0644"
delegate_to: "{{ vm_guest_ip }}"
register: archive_vmtools_logs

- name: "Fetch VMware Tools debug logs"
include_tasks: ../utils/fetch_file.yml
vars:
fetch_file_src_path: "{{ vmtools_log_dir }}.tgz"
fetch_file_dst_path: "{{ current_test_log_folder }}/"
fetch_file_ignore_errors: true
when:
- archive_vmtools_logs is defined
- archive_vmtools_logs.changed is defined
- archive_vmtools_logs.changed
when: guest_file_exists
keirazhang marked this conversation as resolved.
Show resolved Hide resolved