From 3ebcce56c43cc586e1f11a19d856d6638c65ebca Mon Sep 17 00:00:00 2001 From: to-bar <46519524+to-bar@users.noreply.github.com> Date: Tue, 8 Oct 2019 02:34:41 +0200 Subject: [PATCH] Fixes for Azure in repository role #536 --- .../repository/files/client/RedHat/add-epirepo-client.sh | 5 ++++- .../files/download-requirements/centos-7/requirements.txt | 1 + .../files/download-requirements/redhat-7/requirements.txt | 1 + .../repository/files/server/RedHat/create-repository.sh | 7 ++++++- .../playbooks/roles/repository/tasks/RedHat/setup.yml | 4 ++-- 5 files changed, 14 insertions(+), 4 deletions(-) diff --git a/core/src/epicli/data/common/ansible/playbooks/roles/repository/files/client/RedHat/add-epirepo-client.sh b/core/src/epicli/data/common/ansible/playbooks/roles/repository/files/client/RedHat/add-epirepo-client.sh index 035e148361..fd6c3c313d 100644 --- a/core/src/epicli/data/common/ansible/playbooks/roles/repository/files/client/RedHat/add-epirepo-client.sh +++ b/core/src/epicli/data/common/ansible/playbooks/roles/repository/files/client/RedHat/add-epirepo-client.sh @@ -2,7 +2,10 @@ REPOSITORY_URL=$1 -curl -I -L $REPOSITORY_URL | grep "HTTP/1.1 200 OK" +CURL_CMD="curl --head --location --connect-timeout 30 --silent --show-error $REPOSITORY_URL" +CURL_OUTPUT=$($CURL_CMD 2>&1) || { echo "Command failed: $CURL_CMD"; echo "Output was: $CURL_OUTPUT"; exit 2; } + +egrep 'HTTP/.{1,3} 200 OK' <<< "$CURL_OUTPUT" || { echo "HTTP 200 status code not found"; exit 3; } cat << EOF > /etc/yum.repos.d/epirepo.repo [epirepo] diff --git a/core/src/epicli/data/common/ansible/playbooks/roles/repository/files/download-requirements/centos-7/requirements.txt b/core/src/epicli/data/common/ansible/playbooks/roles/repository/files/download-requirements/centos-7/requirements.txt index db67fc1acf..01f99e118c 100644 --- a/core/src/epicli/data/common/ansible/playbooks/roles/repository/files/download-requirements/centos-7/requirements.txt +++ b/core/src/epicli/data/common/ansible/playbooks/roles/repository/files/download-requirements/centos-7/requirements.txt @@ -7,6 +7,7 @@ mod_ssl yum-utils [packages] +audit-libs # for docker-ce bash-completion ca-certificates cifs-utils diff --git a/core/src/epicli/data/common/ansible/playbooks/roles/repository/files/download-requirements/redhat-7/requirements.txt b/core/src/epicli/data/common/ansible/playbooks/roles/repository/files/download-requirements/redhat-7/requirements.txt index db67fc1acf..01f99e118c 100644 --- a/core/src/epicli/data/common/ansible/playbooks/roles/repository/files/download-requirements/redhat-7/requirements.txt +++ b/core/src/epicli/data/common/ansible/playbooks/roles/repository/files/download-requirements/redhat-7/requirements.txt @@ -7,6 +7,7 @@ mod_ssl yum-utils [packages] +audit-libs # for docker-ce bash-completion ca-certificates cifs-utils diff --git a/core/src/epicli/data/common/ansible/playbooks/roles/repository/files/server/RedHat/create-repository.sh b/core/src/epicli/data/common/ansible/playbooks/roles/repository/files/server/RedHat/create-repository.sh index 336fa6c4f2..51db3ee162 100644 --- a/core/src/epicli/data/common/ansible/playbooks/roles/repository/files/server/RedHat/create-repository.sh +++ b/core/src/epicli/data/common/ansible/playbooks/roles/repository/files/server/RedHat/create-repository.sh @@ -12,4 +12,9 @@ fi setenforce 0 systemctl start httpd -createrepo $EPI_REPO_SERVER_PATH/packages \ No newline at end of file +createrepo $EPI_REPO_SERVER_PATH/packages + +if systemctl is-active firewalld; then + firewall-cmd --permanent --add-service=http + firewall-cmd --reload +fi \ No newline at end of file diff --git a/core/src/epicli/data/common/ansible/playbooks/roles/repository/tasks/RedHat/setup.yml b/core/src/epicli/data/common/ansible/playbooks/roles/repository/tasks/RedHat/setup.yml index 0e83cf9548..0c1cc9f7f0 100644 --- a/core/src/epicli/data/common/ansible/playbooks/roles/repository/tasks/RedHat/setup.yml +++ b/core/src/epicli/data/common/ansible/playbooks/roles/repository/tasks/RedHat/setup.yml @@ -1,7 +1,7 @@ --- - name: Create epirepo repository shell: >- - /tmp/epi-repository-setup-scripts/create-repository.sh /var/www/html/epirepo {{ offline_mode }} |& + set -o pipefail && /tmp/epi-repository-setup-scripts/create-repository.sh /var/www/html/epirepo {{ offline_mode }} |& tee /tmp/epi-repository-setup-scripts/create-repository.log when: - not custom_repository_url @@ -15,5 +15,5 @@ shell: /tmp/epi-repository-setup-scripts/disable-system-repos.sh - name: Add and enable epirepo shell: >- - /tmp/epi-repository-setup-scripts/add-epirepo-client.sh {{ repository_url }} |& + set -o pipefail && /tmp/epi-repository-setup-scripts/add-epirepo-client.sh {{ repository_url }} |& tee /tmp/epi-repository-setup-scripts/add-epirepo-client.log