[CORD-1839]
MaaS unable to download/install Ubuntu

Change-Id: I010f8a63097fb5be2785a0db1da21c9e498bb962
diff --git a/roles/maas/files/uefi.py.diff b/roles/maas/files/uefi.py.diff
new file mode 100644
index 0000000..3fa8ab0
--- /dev/null
+++ b/roles/maas/files/uefi.py.diff
@@ -0,0 +1,13 @@
+diff --git a/src/provisioningserver/boot/uefi.py b/src/provisioningserver/boot/uefi.py
+index e770b0e..544a37c 100644
+--- a/src/provisioningserver/boot/uefi.py
++++ b/src/provisioningserver/boot/uefi.py
+@@ -143,7 +143,7 @@ class UEFIBootMethod(BootMethod):
+             # Extract the package with dpkg, and install the shim
+             call_and_check(["dpkg", "-x", shim_output, tmp])
+             install_bootloader(
+-                os.path.join(tmp, 'usr', 'lib', 'shim', 'shim.efi.signed'),
++                os.path.join(tmp, 'usr', 'lib', 'shim', 'shimx64.efi.signed'),
+                 os.path.join(destination, self.bootloader_path))
+ 
+             # Download the grub-efi-amd64-signed package.
diff --git a/roles/maas/tasks/main.yml b/roles/maas/tasks/main.yml
index 25e55ba..bef315d 100644
--- a/roles/maas/tasks/main.yml
+++ b/roles/maas/tasks/main.yml
@@ -91,6 +91,21 @@
   register: status
   ignore_errors: yes
 
+# next two tasks are to repair https://jira.opencord.org/browse/CORD-1839. Remove when fixed upstream
+- name: patch maas file to change filename from shim.efi.signed to shimx64.efi.signed
+  become: yes
+  patch:
+    src: uefi.py.diff
+    dest: /usr/lib/python2.7/dist-packages/provisioningserver/boot/uefi.py
+
+- name: restart maas-regiond to reload uefi.py
+  become: yes
+  service:
+    name: maas-clusterd
+    state: restarted
+  tags:
+    - skip_ansible_lint # need to restart this now, not as a handler
+
 - name: WARNING - We think MAAS install has hung. You may want to abort the install, re-image the head node, and start again.
   pause:
     minutes: 15