Browse Source

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
Olivier Bourdon 2 years ago
parent
commit
7cbe8725a0
7 changed files with 72 additions and 58 deletions
  1. 1
    0
      .gitignore
  2. 3
    12
      functions.sh
  3. 5
    5
      metadata.yaml
  4. 62
    40
      pre_build_hook
  5. 0
    0
      repositories/ubuntu/trusty/.gitkeep
  6. 0
    0
      repositories/ubuntu/xenial/.gitkeep
  7. 1
    1
      tox.ini

+ 1
- 0
.gitignore View File

@@ -2,6 +2,7 @@
2 2
 zabbix_monitoring*.noarch.rpm
3 3
 repositories/centos/*.rpm
4 4
 repositories/ubuntu/*.deb
5
+repositories/ubuntu/*/*.deb
5 6
 .bundled_gems/
6 7
 .bundle/
7 8
 Gemfile.lock

+ 3
- 12
functions.sh View File

@@ -17,22 +17,14 @@ set -eux
17 17
 
18 18
 ROOT="$(dirname "$(readlink -f "$0")")"
19 19
 MODULES_DIR="${ROOT}"/deployment_scripts/puppet/modules
20
-RPM_REPO="${ROOT}"/repositories/centos/
21
-DEB_REPO="${ROOT}"/repositories/ubuntu/
22 20
 
23 21
 # Download RPM or DEB packages and store them in the local repository directory
24 22
 function download_package {
23
+    REPO="$1"
24
+    shift
25 25
     while [ $# -gt 0 ]; do
26
-        if [[ "$1" == *.deb ]]; then
27
-            REPO=$DEB_REPO
28
-        elif [[ "$1" == *.rpm ]]; then
29
-            REPO=$RPM_REPO
30
-        else
31
-            echo "Invalid URL for download_package(): $1"
32
-        fi
33
-
34 26
         FILE=$(basename "$1")
35
-        wget -qO - "$1" > "$REPO"/"$FILE"
27
+        wget -qO "$REPO"/"$FILE" "$1"
36 28
         shift
37 29
     done
38 30
 }
@@ -43,4 +35,3 @@ function download_puppet_module {
43 35
     mkdir -p "${MODULES_DIR}"/"$1"
44 36
     wget -qO- "$2" | tar -C "${MODULES_DIR}/$1" --strip-components=1 -xz
45 37
 }
46
-

+ 5
- 5
metadata.yaml View File

@@ -22,27 +22,27 @@ releases:
22 22
     version: 2015.1.0-7.0
23 23
     mode: ['ha']
24 24
     deployment_scripts_path: deployment_scripts/
25
-    repository_path: repositories/ubuntu
25
+    repository_path: repositories/ubuntu/trusty
26 26
   - os: ubuntu
27 27
     version: liberty-8.0
28 28
     mode: ['ha']
29 29
     deployment_scripts_path: deployment_scripts/
30
-    repository_path: repositories/ubuntu
30
+    repository_path: repositories/ubuntu/trusty
31 31
   - os: ubuntu
32 32
     version: liberty-9.0
33 33
     mode: ['ha']
34 34
     deployment_scripts_path: deployment_scripts/
35
-    repository_path: repositories/ubuntu
35
+    repository_path: repositories/ubuntu/trusty
36 36
   - os: ubuntu
37 37
     version: mitaka-9.0
38 38
     mode: ['ha']
39 39
     deployment_scripts_path: deployment_scripts/
40
-    repository_path: repositories/ubuntu
40
+    repository_path: repositories/ubuntu/trusty
41 41
   - os: ubuntu
42 42
     version: newton-10.0
43 43
     mode: ['ha']
44 44
     deployment_scripts_path: deployment_scripts/
45
-    repository_path: repositories/ubuntu
45
+    repository_path: repositories/ubuntu/xenial
46 46
 
47 47
 # Version of plugin package
48 48
 package_version: '3.0.0'

+ 62
- 40
pre_build_hook View File

@@ -1,7 +1,21 @@
1 1
 #!/bin/bash
2
+# Copyright 2017 Mirantis, Inc.
3
+#
4
+# Licensed under the Apache License, Version 2.0 (the "License");
5
+# you may not use this file except in compliance with the License.
6
+# You may obtain a copy of the License at
7
+#
8
+#     http://www.apache.org/licenses/LICENSE-2.0
9
+#
10
+# Unless required by applicable law or agreed to in writing, software
11
+# distributed under the License is distributed on an "AS IS" BASIS,
12
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+# See the License for the specific language governing permissions and
14
+# limitations under the License.
15
+
2 16
 set -eux
3 17
 
4
-ROOT="$(dirname `readlink -f $0`)"
18
+ROOT="$(dirname "$(readlink -f "$0")")"
5 19
 
6 20
 . "${ROOT}"/functions.sh
7 21
 
@@ -10,47 +24,55 @@ ROOT="$(dirname `readlink -f $0`)"
10 24
 PHPFPM_TARBALL_URL="https://forgeapi.puppetlabs.com/v3/files/Slashbunny-phpfpm-0.0.8.tar.gz"
11 25
 
12 26
 RPM_REPO="${ROOT}"/repositories/centos/
13
-DEB_REPO="${ROOT}"/repositories/ubuntu/
14
-mkdir -p $RPM_REPO
15
-mkdir -p $DEB_REPO
16
-
17
-# Downloads needed RPM or DEB packages
18
-function download {
19
-    case "$1" in
20
-        deb) REPO=$DEB_REPO;;
21
-        rpm) REPO=$RPM_REPO;;
22
-    esac
23
-    shift
24
-
25
-    while [ $# -gt 0 ]; do
26
-        FILE=$(basename "$1")
27
-        wget -qO - $1 > "$REPO/$FILE"
28
-        shift
29
-    done
30
-}
31
-
32
-PHP5_VERSION="5.5.9+dfsg-1ubuntu4.20"
27
+DEB_TRUSTY_REPO="${ROOT}"/repositories/ubuntu/trusty
28
+DEB_XENIAL_REPO="${ROOT}"/repositories/ubuntu/xenial
29
+mkdir -p $RPM_REPO $DEB_TRUSTY_REPO $DEB_XENIAL_REPO
30
+
31
+PHP5_TRUSTY_VERSION="5.5.9+dfsg-1ubuntu4.21"
32
+PHP5_XENIAL_VERSION="5.6.4+dfsg-4ubuntu6.4"
33 33
 ZBX_VERSION="2.4.8-1+trusty"
34 34
 
35
-download deb http://repo.zabbix.com/zabbix/2.4/ubuntu/pool/main/z/zabbix/zabbix-agent_${ZBX_VERSION}_amd64.deb \
36
-             http://repo.zabbix.com/zabbix/2.4/ubuntu/pool/main/z/zabbix/zabbix-frontend-php_${ZBX_VERSION}_all.deb \
37
-             http://repo.zabbix.com/zabbix/2.4/ubuntu/pool/main/z/zabbix/zabbix-server-mysql_${ZBX_VERSION}_amd64.deb \
38
-             http://repo.zabbix.com/zabbix/2.4/ubuntu/pool/main/z/zabbix/zabbix-sender_${ZBX_VERSION}_amd64.deb \
39
-             http://repo.zabbix.com/zabbix/2.4/ubuntu/pool/main/z/zabbix/zabbix-get_${ZBX_VERSION}_amd64.deb \
40
-             http://archive.ubuntu.com/ubuntu/pool/main/p/php5/php5_${PHP5_VERSION}_all.deb \
41
-             http://archive.ubuntu.com/ubuntu/pool/main/p/php5/php5-mysql_${PHP5_VERSION}_amd64.deb \
42
-             http://archive.ubuntu.com/ubuntu/pool/main/p/php5/php5-common_${PHP5_VERSION}_amd64.deb \
43
-             http://archive.ubuntu.com/ubuntu/pool/main/p/php5/php5-gd_${PHP5_VERSION}_amd64.deb \
44
-             http://archive.ubuntu.com/ubuntu/pool/main/p/php-json/php5-json_1.3.2-2build1_amd64.deb \
45
-             http://archive.ubuntu.com/ubuntu/pool/universe/p/php5/php5-fpm_${PHP5_VERSION}_amd64.deb \
46
-             http://archive.ubuntu.com/ubuntu/pool/main/libc/libconfig-inifiles-perl/libconfig-inifiles-perl_2.82-1_all.deb \
47
-             http://archive.ubuntu.com/ubuntu/pool/universe/libs/libsmi/smistrip_0.4.8+dfsg2-8ubuntu2_all.deb \
48
-             http://archive.ubuntu.com/ubuntu/pool/multiverse/s/snmp-mibs-downloader/snmp-mibs-downloader_1.1_all.deb \
49
-             http://archive.ubuntu.com/ubuntu/pool/universe/i/iptstate/iptstate_2.2.5-1_amd64.deb \
50
-             http://archive.ubuntu.com/ubuntu/pool/universe/libi/libiksemel/libiksemel3_1.2-4.2_amd64.deb \
51
-             http://archive.ubuntu.com/ubuntu/pool/main/f/fonts-dejavu/fonts-dejavu_2.34-1ubuntu1_all.deb \
52
-             http://archive.ubuntu.com/ubuntu/pool/main/f/fonts-dejavu/ttf-dejavu-core_2.34-1ubuntu1_all.deb \
53
-             http://archive.ubuntu.com/ubuntu/pool/main/f/fonts-dejavu/fonts-dejavu-extra_2.34-1ubuntu1_all.deb
35
+ZABBIX_PACKAGES="http://repo.zabbix.com/zabbix/2.4/ubuntu/pool/main/z/zabbix/zabbix-agent_${ZBX_VERSION}_amd64.deb \
36
+                 http://repo.zabbix.com/zabbix/2.4/ubuntu/pool/main/z/zabbix/zabbix-frontend-php_${ZBX_VERSION}_all.deb \
37
+                 http://repo.zabbix.com/zabbix/2.4/ubuntu/pool/main/z/zabbix/zabbix-server-mysql_${ZBX_VERSION}_amd64.deb \
38
+                 http://repo.zabbix.com/zabbix/2.4/ubuntu/pool/main/z/zabbix/zabbix-sender_${ZBX_VERSION}_amd64.deb \
39
+                 http://repo.zabbix.com/zabbix/2.4/ubuntu/pool/main/z/zabbix/zabbix-get_${ZBX_VERSION}_amd64.deb"
40
+
41
+COMMON_PACKAGES="http://archive.ubuntu.com/ubuntu/pool/main/libc/libconfig-inifiles-perl/libconfig-inifiles-perl_2.82-1_all.deb \
42
+                 http://archive.ubuntu.com/ubuntu/pool/universe/libs/libsmi/smistrip_0.4.8+dfsg2-8ubuntu2_all.deb \
43
+                 http://archive.ubuntu.com/ubuntu/pool/multiverse/s/snmp-mibs-downloader/snmp-mibs-downloader_1.1_all.deb \
44
+                 http://archive.ubuntu.com/ubuntu/pool/universe/i/iptstate/iptstate_2.2.5-1_amd64.deb \
45
+                 http://archive.ubuntu.com/ubuntu/pool/universe/libi/libiksemel/libiksemel3_1.2-4.2_amd64.deb \
46
+                 http://archive.ubuntu.com/ubuntu/pool/main/f/fonts-dejavu/fonts-dejavu_2.34-1ubuntu1_all.deb \
47
+                 http://archive.ubuntu.com/ubuntu/pool/main/f/fonts-dejavu/ttf-dejavu-core_2.34-1ubuntu1_all.deb \
48
+                 http://archive.ubuntu.com/ubuntu/pool/main/f/fonts-dejavu/fonts-dejavu-extra_2.34-1ubuntu1_all.deb"
49
+
50
+PHP5_TRUSTY_PACKAGES="http://archive.ubuntu.com/ubuntu/pool/main/p/php5/php5_${PHP5_TRUSTY_VERSION}_all.deb \
51
+                      http://archive.ubuntu.com/ubuntu/pool/main/p/php5/php5-mysql_${PHP5_TRUSTY_VERSION}_amd64.deb \
52
+                      http://archive.ubuntu.com/ubuntu/pool/main/p/php5/php5-common_${PHP5_TRUSTY_VERSION}_amd64.deb \
53
+                      http://archive.ubuntu.com/ubuntu/pool/main/p/php5/php5-gd_${PHP5_TRUSTY_VERSION}_amd64.deb \
54
+                      http://archive.ubuntu.com/ubuntu/pool/universe/p/php5/php5-fpm_${PHP5_TRUSTY_VERSION}_amd64.deb \
55
+                      http://archive.ubuntu.com/ubuntu/pool/main/p/php-json/php5-json_1.3.2-2build1_amd64.deb"
56
+             
57
+download_package "$DEB_TRUSTY_REPO" $ZABBIX_PACKAGES \
58
+             $PHP5_TRUSTY_PACKAGES \
59
+             $COMMON_PACKAGES
60
+
61
+PHP5_XENIAL_PACKAGES="http://archive.ubuntu.com/ubuntu/pool/main/p/php5/php5_${PHP5_XENIAL_VERSION}_all.deb \
62
+                      http://archive.ubuntu.com/ubuntu/pool/main/p/php5/php5-mysql_${PHP5_XENIAL_VERSION}_amd64.deb \
63
+                      http://archive.ubuntu.com/ubuntu/pool/main/p/php5/php5-common_${PHP5_XENIAL_VERSION}_amd64.deb \
64
+                      http://archive.ubuntu.com/ubuntu/pool/main/p/php5/php5-gd_${PHP5_XENIAL_VERSION}_amd64.deb \
65
+                      http://archive.ubuntu.com/ubuntu/pool/main/p/php5/php5-cli_${PHP5_XENIAL_VERSION}_amd64.deb \
66
+                      http://archive.ubuntu.com/ubuntu/pool/universe/p/php5/php5-fpm_${PHP5_XENIAL_VERSION}_amd64.deb \
67
+                      http://archive.ubuntu.com/ubuntu/pool/main/p/php-json/php5-json_1.3.6-1build1_amd64.deb"
68
+
69
+download_package "$DEB_XENIAL_REPO" $ZABBIX_PACKAGES \
70
+             $PHP5_XENIAL_PACKAGES \
71
+             $COMMON_PACKAGES \
72
+             http://archive.ubuntu.com/ubuntu/pool/main/m/mysql-5.5/libmysqlclient18_5.5.54-0ubuntu0.14.04.1_amd64.deb \
73
+             http://archive.ubuntu.com/ubuntu/pool/main/libg/libgcrypt11/libgcrypt11_1.5.3-2ubuntu4.4_amd64.deb \
74
+             http://archive.ubuntu.com/ubuntu/pool/main/g/gnutls26/libgnutls26_2.12.23-12ubuntu2.6_amd64.deb \
75
+             http://archive.ubuntu.com/ubuntu/pool/main/s/systemd/libsystemd-daemon0_204-5ubuntu20.24_amd64.deb
54 76
 
55 77
 # Install puppet manifests
56 78
 download_puppet_module "phpfpm" "$PHPFPM_TARBALL_URL"

+ 0
- 0
repositories/ubuntu/trusty/.gitkeep View File


+ 0
- 0
repositories/ubuntu/xenial/.gitkeep View File


+ 1
- 1
tox.ini View File

@@ -35,7 +35,7 @@ whitelist_externals=
35 35
 commands =
36 36
     rm -rf .build
37 37
     bash -c 'rm -rf doc/*/build'
38
-    bash -c 'rm -rf repositories/ubuntu/*.deb repositories/centos/*.rpm'
38
+    bash -c 'rm -rf repositories/ubuntu/*.deb repositories/ubuntu/trusty/*.deb repositories/ubuntu/xenial/*.deb repositories/centos/*.rpm'
39 39
     fpb --check {toxinidir} --debug
40 40
     fpb --build {toxinidir} --debug
41 41
 

Loading…
Cancel
Save