summaryrefslogtreecommitdiffstats
path: root/patches/opnfv-fuel/0002-salt.sh-user-data-Add-Saltstack-arm64-repo.patch
blob: ba0498d1868ffb0cdfd09a2316b9b3f933723f81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
: Copyright (c) 2017 Enea AB and others.
:
: All rights reserved. This program and the accompanying materials
: are made available under the terms of the Apache License, Version 2.0
: which accompanies this distribution, and is available at
: http://www.apache.org/licenses/LICENSE-2.0
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
Date: Tue, 11 Jul 2017 18:57:57 +0200
Subject: [PATCH] salt.sh, user-data: Add Saltstack arm64 repo

While at it, add arm64 suppport to salt-master-setup.sh.
Upstream commit [1] broke Salt bootstrap on AArch64, by
introducing an architecture condition that is too strict to allow
Debian package installation (even if we provide our own repo).

Add "arm64" to the list of supported architectures. This needs
to be done on the fly, as the bootstrap script is fetched using
`curl` from <salt-master-setup.sh>, which is also fetched
dynamically using `svn export`.

[1] https://github.com/saltstack/salt-bootstrap/commit/caa6d7d

FIXME: Use https for fetching GPG repo key.

Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
---
 mcp/scripts/salt.sh            | 6 ++++++
 mcp/scripts/user-data.template | 9 +++++++--
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/mcp/scripts/salt.sh b/mcp/scripts/salt.sh
index 36ee27b..1779954 100755
--- a/mcp/scripts/salt.sh
+++ b/mcp/scripts/salt.sh
@@ -48,6 +48,12 @@ ssh ${SSH_OPTS} "${SSH_SALT}" bash -s << SALT_INSTALL_END
   cd ${OPNFV_FUEL_DIR}/mcp/patches && ./patch.sh patches.list reclass

   cd /srv/salt/scripts
+  if [ "\$(uname -i)" = "aarch64" ]; then
+    # NOTE(armband): On AArch64, skip creating apt source list definitions (-r)
+    export BOOTSTRAP_SALTSTACK_OPTS=" -r -dX stable 2016.3 "
+    sed -i 's/bootstrap.saltstack.com | $SUDO/bootstrap.saltstack.com | sed '"'"'s@"amd64")@"amd64"|"arm64")@g'"'"' | $SUDO/g' \
+      ./salt-master-setup.sh
+  fi
   MASTER_HOSTNAME=cfg01.${CLUSTER_DOMAIN} DISTRIB_REVISION=nightly ./salt-master-init.sh
   salt-key -Ay

diff --git a/mcp/scripts/user-data.template b/mcp/scripts/user-data.template
index cc97a60..c696d35 100644
--- a/mcp/scripts/user-data.template
+++ b/mcp/scripts/user-data.template
@@ -1,6 +1,11 @@
 #!/bin/bash
-wget -O - https://repo.saltstack.com/apt/ubuntu/16.04/amd64/2016.11/SALTSTACK-GPG-KEY.pub | sudo apt-key add -
-echo "deb http://repo.saltstack.com/apt/ubuntu/16.04/amd64/2016.11 xenial main" > /etc/apt/sources.list.d/salt.list
+if [ "$(uname -i)" = "aarch64" ]; then
+  wget -O - http://linux.enea.com/saltstack/apt/ubuntu/16.04/arm64/latest/SALTSTACK-GPG-KEY.pub | sudo apt-key add -
+  echo "deb http://linux.enea.com/saltstack/apt/ubuntu/16.04/arm64/latest xenial main" > /etc/apt/sources.list.d/salt.list
+else
+  wget -O - https://repo.saltstack.com/apt/ubuntu/16.04/amd64/2016.11/SALTSTACK-GPG-KEY.pub | sudo apt-key add -
+  echo "deb http://repo.saltstack.com/apt/ubuntu/16.04/amd64/2016.11 xenial main" > /etc/apt/sources.list.d/salt.list
+fi
 apt update
 apt-get install -y salt-minion
 rm /etc/salt/minion_id