From 7cbe8725a0a40dc76b9d1fbed96c563c9ff8e6f5 Mon Sep 17 00:00:00 2001 From: Olivier Bourdon Date: Thu, 22 Dec 2016 08:56:41 +0100 Subject: [PATCH] Fix MOS 10.0 support Factorize duplicated code for packages download Add missing Copyright to pre_build_hook shell script Fix packages versions for MOS 10.0 Add extra packages and second repository for Xenial Change-Id: I5360519d542ab5551c8d0951a722aa132e38da7c --- .gitignore | 1 + functions.sh | 15 +---- metadata.yaml | 10 +-- pre_build_hook | 100 +++++++++++++++++----------- repositories/ubuntu/trusty/.gitkeep | 0 repositories/ubuntu/xenial/.gitkeep | 0 tox.ini | 2 +- 7 files changed, 71 insertions(+), 57 deletions(-) create mode 100644 repositories/ubuntu/trusty/.gitkeep create mode 100644 repositories/ubuntu/xenial/.gitkeep diff --git a/.gitignore b/.gitignore index 5802f26..105cfe1 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,7 @@ zabbix_monitoring*.noarch.rpm repositories/centos/*.rpm repositories/ubuntu/*.deb +repositories/ubuntu/*/*.deb .bundled_gems/ .bundle/ Gemfile.lock diff --git a/functions.sh b/functions.sh index cf9e407..88fe388 100644 --- a/functions.sh +++ b/functions.sh @@ -17,22 +17,14 @@ set -eux ROOT="$(dirname "$(readlink -f "$0")")" MODULES_DIR="${ROOT}"/deployment_scripts/puppet/modules -RPM_REPO="${ROOT}"/repositories/centos/ -DEB_REPO="${ROOT}"/repositories/ubuntu/ # Download RPM or DEB packages and store them in the local repository directory function download_package { + REPO="$1" + shift while [ $# -gt 0 ]; do - if [[ "$1" == *.deb ]]; then - REPO=$DEB_REPO - elif [[ "$1" == *.rpm ]]; then - REPO=$RPM_REPO - else - echo "Invalid URL for download_package(): $1" - fi - FILE=$(basename "$1") - wget -qO - "$1" > "$REPO"/"$FILE" + wget -qO "$REPO"/"$FILE" "$1" shift done } @@ -43,4 +35,3 @@ function download_puppet_module { mkdir -p "${MODULES_DIR}"/"$1" wget -qO- "$2" | tar -C "${MODULES_DIR}/$1" --strip-components=1 -xz } - diff --git a/metadata.yaml b/metadata.yaml index 1b58824..998b40c 100644 --- a/metadata.yaml +++ b/metadata.yaml @@ -22,27 +22,27 @@ releases: version: 2015.1.0-7.0 mode: ['ha'] deployment_scripts_path: deployment_scripts/ - repository_path: repositories/ubuntu + repository_path: repositories/ubuntu/trusty - os: ubuntu version: liberty-8.0 mode: ['ha'] deployment_scripts_path: deployment_scripts/ - repository_path: repositories/ubuntu + repository_path: repositories/ubuntu/trusty - os: ubuntu version: liberty-9.0 mode: ['ha'] deployment_scripts_path: deployment_scripts/ - repository_path: repositories/ubuntu + repository_path: repositories/ubuntu/trusty - os: ubuntu version: mitaka-9.0 mode: ['ha'] deployment_scripts_path: deployment_scripts/ - repository_path: repositories/ubuntu + repository_path: repositories/ubuntu/trusty - os: ubuntu version: newton-10.0 mode: ['ha'] deployment_scripts_path: deployment_scripts/ - repository_path: repositories/ubuntu + repository_path: repositories/ubuntu/xenial # Version of plugin package package_version: '3.0.0' diff --git a/pre_build_hook b/pre_build_hook index 674b1a7..5727c00 100755 --- a/pre_build_hook +++ b/pre_build_hook @@ -1,7 +1,21 @@ #!/bin/bash +# Copyright 2017 Mirantis, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + set -eux -ROOT="$(dirname `readlink -f $0`)" +ROOT="$(dirname "$(readlink -f "$0")")" . "${ROOT}"/functions.sh @@ -10,47 +24,55 @@ ROOT="$(dirname `readlink -f $0`)" PHPFPM_TARBALL_URL="https://forgeapi.puppetlabs.com/v3/files/Slashbunny-phpfpm-0.0.8.tar.gz" RPM_REPO="${ROOT}"/repositories/centos/ -DEB_REPO="${ROOT}"/repositories/ubuntu/ -mkdir -p $RPM_REPO -mkdir -p $DEB_REPO +DEB_TRUSTY_REPO="${ROOT}"/repositories/ubuntu/trusty +DEB_XENIAL_REPO="${ROOT}"/repositories/ubuntu/xenial +mkdir -p $RPM_REPO $DEB_TRUSTY_REPO $DEB_XENIAL_REPO -# Downloads needed RPM or DEB packages -function download { - case "$1" in - deb) REPO=$DEB_REPO;; - rpm) REPO=$RPM_REPO;; - esac - shift - - while [ $# -gt 0 ]; do - FILE=$(basename "$1") - wget -qO - $1 > "$REPO/$FILE" - shift - done -} - -PHP5_VERSION="5.5.9+dfsg-1ubuntu4.20" +PHP5_TRUSTY_VERSION="5.5.9+dfsg-1ubuntu4.21" +PHP5_XENIAL_VERSION="5.6.4+dfsg-4ubuntu6.4" ZBX_VERSION="2.4.8-1+trusty" -download deb http://repo.zabbix.com/zabbix/2.4/ubuntu/pool/main/z/zabbix/zabbix-agent_${ZBX_VERSION}_amd64.deb \ - http://repo.zabbix.com/zabbix/2.4/ubuntu/pool/main/z/zabbix/zabbix-frontend-php_${ZBX_VERSION}_all.deb \ - http://repo.zabbix.com/zabbix/2.4/ubuntu/pool/main/z/zabbix/zabbix-server-mysql_${ZBX_VERSION}_amd64.deb \ - http://repo.zabbix.com/zabbix/2.4/ubuntu/pool/main/z/zabbix/zabbix-sender_${ZBX_VERSION}_amd64.deb \ - http://repo.zabbix.com/zabbix/2.4/ubuntu/pool/main/z/zabbix/zabbix-get_${ZBX_VERSION}_amd64.deb \ - http://archive.ubuntu.com/ubuntu/pool/main/p/php5/php5_${PHP5_VERSION}_all.deb \ - http://archive.ubuntu.com/ubuntu/pool/main/p/php5/php5-mysql_${PHP5_VERSION}_amd64.deb \ - http://archive.ubuntu.com/ubuntu/pool/main/p/php5/php5-common_${PHP5_VERSION}_amd64.deb \ - http://archive.ubuntu.com/ubuntu/pool/main/p/php5/php5-gd_${PHP5_VERSION}_amd64.deb \ - http://archive.ubuntu.com/ubuntu/pool/main/p/php-json/php5-json_1.3.2-2build1_amd64.deb \ - http://archive.ubuntu.com/ubuntu/pool/universe/p/php5/php5-fpm_${PHP5_VERSION}_amd64.deb \ - http://archive.ubuntu.com/ubuntu/pool/main/libc/libconfig-inifiles-perl/libconfig-inifiles-perl_2.82-1_all.deb \ - http://archive.ubuntu.com/ubuntu/pool/universe/libs/libsmi/smistrip_0.4.8+dfsg2-8ubuntu2_all.deb \ - http://archive.ubuntu.com/ubuntu/pool/multiverse/s/snmp-mibs-downloader/snmp-mibs-downloader_1.1_all.deb \ - http://archive.ubuntu.com/ubuntu/pool/universe/i/iptstate/iptstate_2.2.5-1_amd64.deb \ - http://archive.ubuntu.com/ubuntu/pool/universe/libi/libiksemel/libiksemel3_1.2-4.2_amd64.deb \ - http://archive.ubuntu.com/ubuntu/pool/main/f/fonts-dejavu/fonts-dejavu_2.34-1ubuntu1_all.deb \ - http://archive.ubuntu.com/ubuntu/pool/main/f/fonts-dejavu/ttf-dejavu-core_2.34-1ubuntu1_all.deb \ - http://archive.ubuntu.com/ubuntu/pool/main/f/fonts-dejavu/fonts-dejavu-extra_2.34-1ubuntu1_all.deb +ZABBIX_PACKAGES="http://repo.zabbix.com/zabbix/2.4/ubuntu/pool/main/z/zabbix/zabbix-agent_${ZBX_VERSION}_amd64.deb \ + http://repo.zabbix.com/zabbix/2.4/ubuntu/pool/main/z/zabbix/zabbix-frontend-php_${ZBX_VERSION}_all.deb \ + http://repo.zabbix.com/zabbix/2.4/ubuntu/pool/main/z/zabbix/zabbix-server-mysql_${ZBX_VERSION}_amd64.deb \ + http://repo.zabbix.com/zabbix/2.4/ubuntu/pool/main/z/zabbix/zabbix-sender_${ZBX_VERSION}_amd64.deb \ + http://repo.zabbix.com/zabbix/2.4/ubuntu/pool/main/z/zabbix/zabbix-get_${ZBX_VERSION}_amd64.deb" + +COMMON_PACKAGES="http://archive.ubuntu.com/ubuntu/pool/main/libc/libconfig-inifiles-perl/libconfig-inifiles-perl_2.82-1_all.deb \ + http://archive.ubuntu.com/ubuntu/pool/universe/libs/libsmi/smistrip_0.4.8+dfsg2-8ubuntu2_all.deb \ + http://archive.ubuntu.com/ubuntu/pool/multiverse/s/snmp-mibs-downloader/snmp-mibs-downloader_1.1_all.deb \ + http://archive.ubuntu.com/ubuntu/pool/universe/i/iptstate/iptstate_2.2.5-1_amd64.deb \ + http://archive.ubuntu.com/ubuntu/pool/universe/libi/libiksemel/libiksemel3_1.2-4.2_amd64.deb \ + http://archive.ubuntu.com/ubuntu/pool/main/f/fonts-dejavu/fonts-dejavu_2.34-1ubuntu1_all.deb \ + http://archive.ubuntu.com/ubuntu/pool/main/f/fonts-dejavu/ttf-dejavu-core_2.34-1ubuntu1_all.deb \ + http://archive.ubuntu.com/ubuntu/pool/main/f/fonts-dejavu/fonts-dejavu-extra_2.34-1ubuntu1_all.deb" + +PHP5_TRUSTY_PACKAGES="http://archive.ubuntu.com/ubuntu/pool/main/p/php5/php5_${PHP5_TRUSTY_VERSION}_all.deb \ + http://archive.ubuntu.com/ubuntu/pool/main/p/php5/php5-mysql_${PHP5_TRUSTY_VERSION}_amd64.deb \ + http://archive.ubuntu.com/ubuntu/pool/main/p/php5/php5-common_${PHP5_TRUSTY_VERSION}_amd64.deb \ + http://archive.ubuntu.com/ubuntu/pool/main/p/php5/php5-gd_${PHP5_TRUSTY_VERSION}_amd64.deb \ + http://archive.ubuntu.com/ubuntu/pool/universe/p/php5/php5-fpm_${PHP5_TRUSTY_VERSION}_amd64.deb \ + http://archive.ubuntu.com/ubuntu/pool/main/p/php-json/php5-json_1.3.2-2build1_amd64.deb" + +download_package "$DEB_TRUSTY_REPO" $ZABBIX_PACKAGES \ + $PHP5_TRUSTY_PACKAGES \ + $COMMON_PACKAGES + +PHP5_XENIAL_PACKAGES="http://archive.ubuntu.com/ubuntu/pool/main/p/php5/php5_${PHP5_XENIAL_VERSION}_all.deb \ + http://archive.ubuntu.com/ubuntu/pool/main/p/php5/php5-mysql_${PHP5_XENIAL_VERSION}_amd64.deb \ + http://archive.ubuntu.com/ubuntu/pool/main/p/php5/php5-common_${PHP5_XENIAL_VERSION}_amd64.deb \ + http://archive.ubuntu.com/ubuntu/pool/main/p/php5/php5-gd_${PHP5_XENIAL_VERSION}_amd64.deb \ + http://archive.ubuntu.com/ubuntu/pool/main/p/php5/php5-cli_${PHP5_XENIAL_VERSION}_amd64.deb \ + http://archive.ubuntu.com/ubuntu/pool/universe/p/php5/php5-fpm_${PHP5_XENIAL_VERSION}_amd64.deb \ + http://archive.ubuntu.com/ubuntu/pool/main/p/php-json/php5-json_1.3.6-1build1_amd64.deb" + +download_package "$DEB_XENIAL_REPO" $ZABBIX_PACKAGES \ + $PHP5_XENIAL_PACKAGES \ + $COMMON_PACKAGES \ + http://archive.ubuntu.com/ubuntu/pool/main/m/mysql-5.5/libmysqlclient18_5.5.54-0ubuntu0.14.04.1_amd64.deb \ + http://archive.ubuntu.com/ubuntu/pool/main/libg/libgcrypt11/libgcrypt11_1.5.3-2ubuntu4.4_amd64.deb \ + http://archive.ubuntu.com/ubuntu/pool/main/g/gnutls26/libgnutls26_2.12.23-12ubuntu2.6_amd64.deb \ + http://archive.ubuntu.com/ubuntu/pool/main/s/systemd/libsystemd-daemon0_204-5ubuntu20.24_amd64.deb # Install puppet manifests download_puppet_module "phpfpm" "$PHPFPM_TARBALL_URL" diff --git a/repositories/ubuntu/trusty/.gitkeep b/repositories/ubuntu/trusty/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/repositories/ubuntu/xenial/.gitkeep b/repositories/ubuntu/xenial/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/tox.ini b/tox.ini index 9b8cc1c..c6af330 100644 --- a/tox.ini +++ b/tox.ini @@ -35,7 +35,7 @@ whitelist_externals= commands = rm -rf .build bash -c 'rm -rf doc/*/build' - bash -c 'rm -rf repositories/ubuntu/*.deb repositories/centos/*.rpm' + bash -c 'rm -rf repositories/ubuntu/*.deb repositories/ubuntu/trusty/*.deb repositories/ubuntu/xenial/*.deb repositories/centos/*.rpm' fpb --check {toxinidir} --debug fpb --build {toxinidir} --debug