B&R: Add wildcards parameter on tar commands

The restore-platform playbook extracts some files using
pattern matching characters in the file names, on centOS
the command work as it is, but on Debian is necessary to
use the --wildcards option to enable the pattern matching,
or it will raise an exception (see bug). Adding the option
has no effect on the behavior in centOS.

Test Plan:
PASS: Perform platform restore Debian
PASS: Perform platform restore CentOS

Closes-bug: 1980162

Signed-off-by: Hugo Brito <hugo.brito@windriver.com>
Change-Id: Ifb58053d342d0a0c60c233659f579590ac6d2dc9
This commit is contained in:
Hugo Brito
2022-06-28 20:59:03 -03:00
committed by Hugo Nicodemos
parent 6d36946131
commit 6903161020
4 changed files with 17 additions and 17 deletions

View File

@@ -52,8 +52,8 @@
- name: Prefetch all hieradata
command: >-
tar -C {{ hieradata_workdir }} -xpf {{ restore_data_file }} --transform='s,.*/,,'
'{{ archive_puppet_permdir }}/*.yaml'
tar -C {{ hieradata_workdir }} -xpf {{ restore_data_file }} --wildcards
--transform='s,.*/,,' '{{ archive_puppet_permdir }}/*.yaml'
args:
warn: false

View File

@@ -216,8 +216,8 @@
- block:
- name: Restore certificate and key files
command: >-
tar -C /etc/ssl/private -xpf {{ restore_data_file }} --transform='s,.*/,,'
'etc/ssl/private/*cert*'
tar -C /etc/ssl/private -xpf {{ restore_data_file }} --wildcards
--transform='s,.*/,,' 'etc/ssl/private/*cert*'
args:
warn: false

View File

@@ -28,7 +28,7 @@
- name: Extract etcd database backup to temporary folder
command: >-
tar -C {{ etcd_tmp_dir }} -xpf {{ restore_data_file }}
tar -C {{ etcd_tmp_dir }} -xpf {{ restore_data_file }} --wildcards
--transform='s,.*/,,' '*/etcd-snapshot.db'
args:
warn: false

View File

@@ -141,7 +141,7 @@
check_platform_license.rc == 0
- name: Check if SSH config directory exists in backup tarball
command: tar -tf {{ restore_data_file }} 'etc/ssh/*'
command: tar -tf {{ restore_data_file }} --wildcards 'etc/ssh/*'
register: check_ssh_dir
failed_when: false
args:
@@ -151,7 +151,7 @@
- name: Restore SSH config directory
command: >-
tar -C /etc/ssh -xpf {{ restore_data_file }} --overwrite
--transform='s,.*/,,' etc/ssh/*
--wildcards --transform='s,.*/,,' etc/ssh/*
args:
warn: false
@@ -193,16 +193,16 @@
args:
warn: false
- name: Restore dnsmaq in config permdir (/opt/platform/config/...)
- name: Restore dnsmasq in config permdir (/opt/platform/config/...)
command: >-
tar -C {{ config_permdir }} -xpf {{ restore_data_file }}
tar -C {{ config_permdir }} -xpf {{ restore_data_file }} --wildcards
--overwrite --transform='s,.*/,,' '{{ archive_config_permdir }}/dnsmasq*'
args:
warn: false
- name: Restore boot files in pxelinux.cfg dir
command: >-
tar -C {{ pxe_config_permdir }} -xpf {{ restore_data_file }}
tar -C {{ pxe_config_permdir }} -xpf {{ restore_data_file }} --wildcards
--overwrite --transform='s,.*/,,' '{{ archive_config_permdir }}/pxelinux.cfg/*-*-*'
args:
warn: false
@@ -210,7 +210,7 @@
- name: Extract ldap.db to staging directory
command: >-
tar -C {{ staging_dir }} -xpf {{ restore_data_file }}
tar -C {{ staging_dir }} -xpf {{ restore_data_file }} --wildcards
--transform='s,.*/,,' '*/ldap.db'
args:
warn: false
@@ -244,7 +244,7 @@
state: absent
- name: Restore home directory
shell: tar -C / --overwrite -xpf {{ restore_data_file }} 'home/*'
shell: tar -C / --wildcards --overwrite -xpf {{ restore_data_file }} 'home/*'
args:
warn: false
become_user: root
@@ -300,13 +300,13 @@
- name: Restore sysinv default configuration file
command: >-
tar -C {{ sysinv_config_permdir }} -xpf {{ restore_data_file }}
--transform='s,.*/,,' '*/sysinv.conf.default'
--wildcards --transform='s,.*/,,' '*/sysinv.conf.default'
args:
warn: false
- name: Restore coredump.conf.d directory
command: >-
tar -C /etc/systemd/coredump.conf.d -xpf {{ restore_data_file }}
tar -C /etc/systemd/coredump.conf.d -xpf {{ restore_data_file }} --wildcards
--overwrite --transform='s,.*/,,' etc/systemd/coredump.conf.d/*
args:
warn: false
@@ -337,7 +337,7 @@
- name: Restore ceph crush map
command: >-
tar -C {{ ceph_crushmap_dir }} -xpf {{ restore_data_file }}
--transform='s,.*/,,' '*/crushmap.bin.backup'
--wildcards --transform='s,.*/,,' '*/crushmap.bin.backup'
args:
warn: false
@@ -419,7 +419,7 @@
- name: Extract postgres db to staging directory
command: >-
tar -C {{ staging_dir }}/postgres -xpf {{ restore_data_file }}
--transform='s,.*/,,' '*/*\.postgreSql\.*'
--wildcards --transform='s,.*/,,' '*/*\.postgreSql\.*'
args:
warn: false
@@ -462,7 +462,7 @@
- name: Migrate fernet keys
command: >-
tar -C {{ fernet_keys_permdir }} -xpf {{ restore_data_file }} --overwrite
--transform='s,.*/,,' {{ archive_fernet_keys_permdir }}/*
--wildcards --transform='s,.*/,,' {{ archive_fernet_keys_permdir }}/*
args:
warn: false
when: check_fernet_keys_dir.rc == 0