openshift / openshift-ansible-contrib

Additional roles and playbooks for OpenShift installation and management
https://www.openshift.com
Apache License 2.0
283 stars 372 forks source link

Support firewalld in backup_master_node.sh #1059

Closed tmartensson closed 4 years ago

tmartensson commented 6 years ago

Is this a BUG REPORT or a FEATURE REQUEST ? (choose one): FEATURE REQUEST

FEATURE REQUEST INFO

backup_master_node.sh script should support both firewalld and iptables. If the masters are running firewalld instead of iptables the backup script fails with: cp: cannot stat ‘/etc/sysconfig/iptables’: No such file or directory

Problem Description

What problem is being solved by the proposed feature? backup_master_node.sh fails on masters running firewalld

Proposed Change

Add a check in backup_master_node.sh if the master is running firewalld or iptables and backup the appropriate directory in /etc.

Implementation

Add a check in backup_master_node.sh if the master is running firewalld, for example:

otherfiles(){
  if pgrep firewalld 2>&1 > /dev/null && [ $(firewall-cmd --state) == "running" ]; then
      fw_dir="firewalld"
    else
      fw_dir="iptables"
  fi
 [..]
  cp -aR /etc/sysconfig/{"$fw_dir",docker-*} \
    ${BACKUPLOCATION}/etc/sysconfig/

Acceptance criteria

backup_master_node.sh should exit without errors on masters running firewalld

Testing

Run backup_master_node.sh on a master running firewalld

e-minguez commented 4 years ago

Those scripts are no longer updated and are not supported. Closing this. Thanks