p/fuel: Rebase: openstack_ha upstream sync
[armband.git] / patches / opnfv-fuel / 0002-salt.sh-user-data-Add-Saltstack-arm64-repo.patch
1 From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
2 Date: Tue, 11 Jul 2017 18:57:57 +0200
3 Subject: [PATCH] salt.sh, user-data: Add Saltstack arm64 repo
4
5 While at it, add arm64 suppport to salt-master-setup.sh.
6 Upstream commit [1] broke Salt bootstrap on AArch64, by
7 introducing an architecture condition that is too strict to allow
8 Debian package installation (even if we provide our own repo).
9
10 Add "arm64" to the list of supported architectures. This needs
11 to be done on the fly, as the bootstrap script is fetched using
12 `curl` from <salt-master-setup.sh>, which is also fetched
13 dynamically using `svn export`.
14
15 [1] https://github.com/saltstack/salt-bootstrap/commit/caa6d7d
16
17 FIXME: Use https for fetching GPG repo key.
18
19 Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
20 ---
21  mcp/scripts/salt.sh            | 6 ++++++
22  mcp/scripts/user-data.template | 9 +++++++--
23  2 files changed, 13 insertions(+), 2 deletions(-)
24
25 diff --git a/mcp/scripts/salt.sh b/mcp/scripts/salt.sh
26 index 36ee27b..1779954 100755
27 --- a/mcp/scripts/salt.sh
28 +++ b/mcp/scripts/salt.sh
29 @@ -48,6 +48,12 @@ ssh ${SSH_OPTS} "${SSH_SALT}" bash -s << SALT_INSTALL_END
30    cd ${OPNFV_FUEL_DIR}/mcp/patches && ./patch.sh patches.list reclass
31
32    cd /srv/salt/scripts
33 +  if [ "\$(uname -i)" = "aarch64" ]; then
34 +    # NOTE(armband): On AArch64, skip creating apt source list definitions (-r)
35 +    export BOOTSTRAP_SALTSTACK_OPTS=" -r -dX stable 2016.3 "
36 +    sed -i 's/bootstrap.saltstack.com | $SUDO/bootstrap.saltstack.com | sed '"'"'s@"amd64")@"amd64"|"arm64")@g'"'"' | $SUDO/g' \
37 +      ./salt-master-setup.sh
38 +  fi
39    MASTER_HOSTNAME=cfg01.${CLUSTER_DOMAIN} DISTRIB_REVISION=nightly ./salt-master-init.sh
40    salt-key -Ay
41
42 diff --git a/mcp/scripts/user-data.template b/mcp/scripts/user-data.template
43 index cc97a60..c696d35 100644
44 --- a/mcp/scripts/user-data.template
45 +++ b/mcp/scripts/user-data.template
46 @@ -1,6 +1,11 @@
47  #!/bin/bash
48 -wget -O - https://repo.saltstack.com/apt/ubuntu/16.04/amd64/2016.11/SALTSTACK-GPG-KEY.pub | sudo apt-key add -
49 -echo "deb http://repo.saltstack.com/apt/ubuntu/16.04/amd64/2016.11 xenial main" > /etc/apt/sources.list.d/salt.list
50 +if [ "$(uname -i)" = "aarch64" ]; then
51 +  wget -O - http://linux.enea.com/saltstack/apt/ubuntu/16.04/arm64/latest/SALTSTACK-GPG-KEY.pub | sudo apt-key add -
52 +  echo "deb http://linux.enea.com/saltstack/apt/ubuntu/16.04/arm64/latest xenial main" > /etc/apt/sources.list.d/salt.list
53 +else
54 +  wget -O - https://repo.saltstack.com/apt/ubuntu/16.04/amd64/2016.11/SALTSTACK-GPG-KEY.pub | sudo apt-key add -
55 +  echo "deb http://repo.saltstack.com/apt/ubuntu/16.04/amd64/2016.11 xenial main" > /etc/apt/sources.list.d/salt.list
56 +fi
57  apt update
58  apt-get install -y salt-minion
59  rm /etc/salt/minion_id