p/fuel: Update armband state for baremetal support
[armband.git] / patches / opnfv-fuel / 0016-mcp-salt-formulas-armband-AArch64-bootstrap.patch
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
4
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`.
8
9 NOTE: This change will be leveraged by passing a custom DEB repo to
10 the bootstrap script with `-R linux.enea.com/saltstack`.
11
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.
14
15 [1] http://bootstrap.saltstack.com
16
17 Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
18 ---
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
25
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
31
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'"
37
38 diff --git a/mcp/salt-formulas/armband/bootstrap_script_arm64.sls b/mcp/salt-formulas/armband/bootstrap_script_arm64.sls
39 new file mode 100644
40 index 0000000..845dedd
41 --- /dev/null
42 +++ b/mcp/salt-formulas/armband/bootstrap_script_arm64.sls
43 @@ -0,0 +1,4 @@
44 +/usr/lib/python2.7/dist-packages/salt/utils/cloud.py:
45 +  file.patch:
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
49 new file mode 100644
50 index 0000000..75c3281
51 --- /dev/null
52 +++ b/mcp/salt-formulas/armband/files/cloud.py.diff
53 @@ -0,0 +1,29 @@
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
57 +
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`.
61 +
62 +NOTE: This change will be leveraged by passing a custom DEB repo to
63 +the bootstrap script with `-R linux.enea.com/saltstack`.
64 +
65 +[1] http://bootstrap.saltstack.com
66 +
67 +Signed-off-by: Alexandru Avadanii <Alexandru.Avadanii@enea.com>
68 +---
69 +
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 !')
76 +
77 ++    # NOTE(armband): edit bootstrap script on the fly to allow AArch64
78 ++    script_content = script_content.replace('"amd64")', '"amd64"|"arm64")')
79 ++
80 +     # Get the path to the built-in deploy scripts directory
81 +     builtin_deploy_dir = os.path.join(
82 +         os.path.dirname(__file__),