1 From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
2 Date: Mon, 21 Aug 2017 20:53:03 +0200
3 Subject: [PATCH] mcp: salt-formulas: armband: AArch64 bootstrap
5 Recent changes in salt bootstrap script from [1] whitelist a
6 fixed pool of known architectures. Add "arm64" to that list on the
7 fly, as part of `config.gather_bootstrap_script`.
9 NOTE: This change will be leveraged by passing a custom DEB repo to
10 the bootstrap script with `-R linux.enea.com/saltstack`.
12 NOTE: After running this new state, salt-minion should be restarted
13 to pick up the changes, so we'll run it before rebooting kvm nodes.
15 [1] http://bootstrap.saltstack.com
17 Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
19 mcp/config/states/maas | 1 +
20 .../armband/bootstrap_script_arm64.sls | 4 +++
21 mcp/salt-formulas/armband/files/cloud.py.diff | 29 ++++++++++++++++++++++
22 3 files changed, 34 insertions(+)
23 create mode 100644 mcp/salt-formulas/armband/bootstrap_script_arm64.sls
24 create mode 100644 mcp/salt-formulas/armband/files/cloud.py.diff
26 diff --git a/mcp/config/states/maas b/mcp/config/states/maas
27 index fcb8ce3..12ef9ed 100755
28 --- a/mcp/config/states/maas
29 +++ b/mcp/config/states/maas
30 @@ -76,6 +76,7 @@ salt -C '* and not cfg01* and not mas01*' saltutil.sync_all
32 salt -C 'kvm*' pkg.install bridge-utils
33 salt -C 'kvm*' state.apply linux.network
34 +salt -C 'kvm*' state.apply armband.bootstrap_script_arm64
35 salt -C 'kvm*' system.reboot
36 wait_for 90 "! salt '*' test.ping | tee /dev/stderr | fgrep -q 'Not connected'"
38 diff --git a/mcp/salt-formulas/armband/bootstrap_script_arm64.sls b/mcp/salt-formulas/armband/bootstrap_script_arm64.sls
40 index 0000000..845dedd
42 +++ b/mcp/salt-formulas/armband/bootstrap_script_arm64.sls
44 +/usr/lib/python2.7/dist-packages/salt/utils/cloud.py:
46 + - source: salt://armband/files/cloud.py.diff
47 + - hash: "ecd450b187156c1f6a91ea272fd668b0"
48 diff --git a/mcp/salt-formulas/armband/files/cloud.py.diff b/mcp/salt-formulas/armband/files/cloud.py.diff
50 index 0000000..75c3281
52 +++ b/mcp/salt-formulas/armband/files/cloud.py.diff
54 +From: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
55 +Date: Sun Aug 20 18:18:53 2017 +0200
56 +Subject: [PATCH] cloud.py: Allow AArch64 arch in salt bootstrap
58 +Recent changes in salt bootstrap script from [1] whitelist a
59 +fixed pool of known architectures. Add "arm64" to that list on the
60 +fly, as part of `config.gather_bootstrap_script`.
62 +NOTE: This change will be leveraged by passing a custom DEB repo to
63 +the bootstrap script with `-R linux.enea.com/saltstack`.
65 +[1] http://bootstrap.saltstack.com
67 +Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
70 +diff --git a//usr/lib/python2.7/dist-packages/salt/utils/cloud.py b//usr/lib/python2.7/dist-packages/salt/utils/cloud.py
71 +--- a//usr/lib/python2.7/dist-packages/salt/utils/cloud.py
72 ++++ b//usr/lib/python2.7/dist-packages/salt/utils/cloud.py
73 +@@ -2772,6 +2772,9 @@
74 + if not script_content:
75 + raise ValueError('No content in bootstrap script !')
77 ++ # NOTE(armband): edit bootstrap script on the fly to allow AArch64
78 ++ script_content = script_content.replace('"amd64")', '"amd64"|"arm64")')
80 + # Get the path to the built-in deploy scripts directory
81 + builtin_deploy_dir = os.path.join(
82 + os.path.dirname(__file__),