diff --git a/openstack/baremetal/configdrive.py b/openstack/baremetal/configdrive.py index abbebf5a3..b43d19b3c 100644 --- a/openstack/baremetal/configdrive.py +++ b/openstack/baremetal/configdrive.py @@ -84,21 +84,32 @@ def pack(path): :return: configdrive contents as a base64-encoded string. """ with tempfile.NamedTemporaryFile() as tmpfile: - try: - p = subprocess.Popen(['genisoimage', - '-o', tmpfile.name, - '-ldots', '-allow-lowercase', - '-allow-multidot', '-l', - '-publisher', 'metalsmith', - '-quiet', '-J', - '-r', '-V', 'config-2', - path], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE) - except OSError as e: + # NOTE(toabctl): Luckily, genisoimage, mkisofs and xorrisofs understand + # the same parameters which are currently used. + cmds = ['genisoimage', 'mkisofs', 'xorrisofs'] + for c in cmds: + try: + p = subprocess.Popen([c, + '-o', tmpfile.name, + '-ldots', '-allow-lowercase', + '-allow-multidot', '-l', + '-publisher', 'metalsmith', + '-quiet', '-J', + '-r', '-V', 'config-2', + path], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE) + except OSError as e: + error = e + else: + error = None + break + + if error: raise RuntimeError( 'Error generating the configdrive. Make sure the ' - '"genisoimage" tool is installed. Error: %s' % e) + '"genisoimage", "mkisofs" or "xorrisofs" tool is installed. ' + 'Error: %s' % error) stdout, stderr = p.communicate() if p.returncode != 0: diff --git a/releasenotes/notes/baremetal-configdrive-mkisofs-xorrisofs-075db4d7d80e5a13.yaml b/releasenotes/notes/baremetal-configdrive-mkisofs-xorrisofs-075db4d7d80e5a13.yaml new file mode 100644 index 000000000..008459e8d --- /dev/null +++ b/releasenotes/notes/baremetal-configdrive-mkisofs-xorrisofs-075db4d7d80e5a13.yaml @@ -0,0 +1,8 @@ +--- +features: + - | + When generating a config drive for baremetal, "mkisofs" and "xorrisofs" + are now supported beside the already available "genisoimage" binary. + This is useful on environment where the "genisoimage" binary is not + available but "mkisofs" and/or "xorrisofs" are available. +