Code review comment for ~smoser/curtin:fix/common-script-exits-non-zero

Revision history for this message
Scott Moser (smoser) wrote :

I've added another commit to the top to fix another issue i saw.

http://paste.ubuntu.com/p/3bSnVyfrkW/

the paste above is more readable, but for inclusion i'll put here also.

$ python ./mytest.py
super1=['FromSuper1', 'FromSuper1', 'fromMysub']
super2=['FromSuper1']
sub=['FromSuper1', 'FromSuper1', 'fromMysub']

$ cat mytest.py
#!/usr/bin/python3
"""This demonstrates a bug in vmtest where subclasses would
unintentionally modify the super class 'extra_collect_scripts'.

We had this in:
  TestLvmOverRaidAbs
  TestLvmIscsiAbs
  TestMdadmIscsiAbs

You can see the issue by running the script. You'll see that
MySuper.scripts actually gets 'fromMysub' in it."""

class MySuper1(object):
    scripts = ['FromSuper1']

class MySuper2(object):
    scripts = ['FromSuper1']

class MySub(MySuper1, MySuper2):
    scripts = MySuper1.scripts
    scripts += MySuper2.scripts
    scripts += ["fromMysub"]

print("super1=%s" % MySuper1.scripts)
print("super2=%s" % MySuper2.scripts)
print("sub=%s" % MySub.scripts)

« Back to merge proposal