1 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
2 : Copyright (c) 2017 Enea AB and others.
4 : All rights reserved. This program and the accompanying materials
5 : are made available under the terms of the Apache License, Version 2.0
6 : which accompanies this distribution, and is available at
7 : http://www.apache.org/licenses/LICENSE-2.0
8 ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
9 From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
10 Date: Mon, 21 Aug 2017 20:53:03 +0200
11 Subject: [PATCH] mcp: salt-formulas: armband: AArch64 bootstrap
13 Recent changes in salt bootstrap script from [1] whitelist a
14 fixed pool of known architectures. Add "arm64" to that list on the
15 fly, as part of `config.gather_bootstrap_script`.
17 NOTE: This change will be leveraged by passing a custom DEB repo to
18 the bootstrap script with `-R linux.enea.com/saltstack`.
20 NOTE: After running this new state, salt-minion should be restarted
21 to pick up the changes, so we'll run it before rebooting kvm nodes.
23 [1] http://bootstrap.saltstack.com
25 Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
27 mcp/config/states/maas | 1 +
28 .../armband/bootstrap_script_arm64.sls | 4 +++
29 mcp/salt-formulas/armband/files/cloud.py.diff | 29 ++++++++++++++++++++++
30 3 files changed, 34 insertions(+)
31 create mode 100644 mcp/salt-formulas/armband/bootstrap_script_arm64.sls
32 create mode 100644 mcp/salt-formulas/armband/files/cloud.py.diff
34 diff --git a/mcp/config/states/maas b/mcp/config/states/maas
35 index 42738e3..1adccbf 100755
36 --- a/mcp/config/states/maas
37 +++ b/mcp/config/states/maas
38 @@ -85,6 +85,7 @@ salt -C '* and not cfg01* and not mas01*' saltutil.sync_all
40 salt -C 'kvm*' pkg.install bridge-utils
41 salt -C 'kvm*' state.apply linux.network
42 +salt -C 'kvm*' state.apply armband.bootstrap_script_arm64
43 salt -C 'kvm*' system.reboot
44 wait_for 90 "! salt 'kvm*' test.ping | tee /dev/stderr | fgrep -q 'Not connected'"
46 diff --git a/mcp/salt-formulas/armband/bootstrap_script_arm64.sls b/mcp/salt-formulas/armband/bootstrap_script_arm64.sls
48 index 0000000..845dedd
50 +++ b/mcp/salt-formulas/armband/bootstrap_script_arm64.sls
52 +/usr/lib/python2.7/dist-packages/salt/utils/cloud.py:
54 + - source: salt://armband/files/cloud.py.diff
55 + - hash: "ecd450b187156c1f6a91ea272fd668b0"
56 diff --git a/mcp/salt-formulas/armband/files/cloud.py.diff b/mcp/salt-formulas/armband/files/cloud.py.diff
58 index 0000000..75c3281
60 +++ b/mcp/salt-formulas/armband/files/cloud.py.diff
62 +From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
63 +Date: Sun Aug 20 18:18:53 2017 +0200
64 +Subject: [PATCH] cloud.py: Allow AArch64 arch in salt bootstrap
66 +Recent changes in salt bootstrap script from [1] whitelist a
67 +fixed pool of known architectures. Add "arm64" to that list on the
68 +fly, as part of `config.gather_bootstrap_script`.
70 +NOTE: This change will be leveraged by passing a custom DEB repo to
71 +the bootstrap script with `-R linux.enea.com/saltstack`.
73 +[1] http://bootstrap.saltstack.com
75 +Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
78 +diff --git a//usr/lib/python2.7/dist-packages/salt/utils/cloud.py b//usr/lib/python2.7/dist-packages/salt/utils/cloud.py
79 +--- a//usr/lib/python2.7/dist-packages/salt/utils/cloud.py
80 ++++ b//usr/lib/python2.7/dist-packages/salt/utils/cloud.py
81 +@@ -2772,6 +2772,9 @@
82 + if not script_content:
83 + raise ValueError('No content in bootstrap script !')
85 ++ # NOTE(armband): edit bootstrap script on the fly to allow AArch64
86 ++ script_content = script_content.replace('"amd64")', '"amd64"|"arm64")')
88 + # Get the path to the built-in deploy scripts directory
89 + builtin_deploy_dir = os.path.join(
90 + os.path.dirname(__file__),