← Back to team overview

curtin-dev team mailing list archive

[Merge] ~dbungert/curtin:lp-2101831-zipl into curtin:master

 

Dan Bungert has proposed merging ~dbungert/curtin:lp-2101831-zipl into curtin:master.

Commit message:
NO SQUASH

curthooks: move zipl invocation after update-initramfs

To match the behavior of the zz-zipl script in s390-tools, zipl should
be invoked after the initrd is in place.

+ fix for the `imp` deprecation, how did this not fail before?

Requested reviews:
  curtin developers (curtin-dev)

For more details, see:
https://code.launchpad.net/~dbungert/curtin/+git/curtin/+merge/482801
-- 
Your team curtin developers is requested to review the proposed merge of ~dbungert/curtin:lp-2101831-zipl into curtin:master.
diff --git a/curtin/commands/curthooks.py b/curtin/commands/curthooks.py
index 2815d3b..abf47c6 100644
--- a/curtin/commands/curthooks.py
+++ b/curtin/commands/curthooks.py
@@ -907,6 +907,8 @@ def setup_boot(
                                  'extlinux at present' % machine)
             install_extlinux(cfg, target)
 
+    run_zipl(cfg, target)
+
 
 def update_initramfs(target=None, all_kernels=False):
     """ Invoke update-initramfs in the target path.
@@ -1974,7 +1976,6 @@ def builtin_curthooks(cfg, target, state):
             setup_zipl(cfg, target)
             setup_kernel_img_conf(target)
             install_kernel(cfg, target)
-            run_zipl(cfg, target)
             restore_dist_interfaces(cfg, target)
             chzdev_persist_active_online(cfg, target)
 
diff --git a/tests/unittests/helpers.py b/tests/unittests/helpers.py
index 3e01b3a..d7a248d 100644
--- a/tests/unittests/helpers.py
+++ b/tests/unittests/helpers.py
@@ -1,7 +1,5 @@
 # This file is part of curtin. See LICENSE file for copyright and license info.
 
-import imp
-import importlib
 import logging
 from unittest import mock
 import os
@@ -17,27 +15,12 @@ from curtin import util
 _real_subp = util.subp
 
 
-def builtin_module_name():
-    options = ('builtins', '__builtin__')
-    for name in options:
-        try:
-            imp.find_module(name)
-        except ImportError:
-            continue
-        else:
-            print('importing and returning: %s' % name)
-            importlib.import_module(name)
-            return name
-
-
 @contextmanager
 def simple_mocked_open(content=None):
     if not content:
         content = ''
     m_open = mock.mock_open(read_data=content)
-    mod_name = builtin_module_name()
-    m_patch = '{}.open'.format(mod_name)
-    with mock.patch(m_patch, m_open, create=True):
+    with mock.patch('builtins.open', m_open, create=True):
         yield m_open
 
 

Follow ups