lorax-composer: Add liveimg-tar image type

This creates a tar suitable for use with the anaconda kickstart liveimg
command. It adds the kernel, grub2, and grub2-tools packages to the tar
template.
This commit is contained in:
Brian C. Lane 2019-08-02 09:50:54 -07:00
parent 361c6de2de
commit b9d18216ef
4 changed files with 74 additions and 2 deletions

View File

@ -0,0 +1,47 @@
# Lorax Composer tar output kickstart template
# Add kernel and grub2 for use with anaconda's kickstart liveimg command
# Firewall configuration
firewall --enabled
# NOTE: The root account is locked by default
# Network information
network --bootproto=dhcp --onboot=on --activate
# NOTE: keyboard and lang can be replaced by blueprint customizations.locale settings
# System keyboard
keyboard --xlayouts=us --vckeymap=us
# System language
lang en_US.UTF-8
# SELinux configuration
selinux --enforcing
# Installation logging level
logging --level=info
# Shutdown after installation
shutdown
# System bootloader configuration (tar doesn't need a bootloader)
bootloader --location=none
%post
# Remove random-seed
rm /var/lib/systemd/random-seed
# Clear /etc/machine-id
rm /etc/machine-id
touch /etc/machine-id
# Remove the rescue kernel and image to save space
rm -f /boot/*-rescue*
%end
# NOTE Do NOT add any other sections after %packages
%packages --nocore
# Packages requires to support this output format go here
policycoreutils
selinux-policy-targeted
# Packages needed for liveimg
kernel
grub2
grub2-tools
# NOTE lorax-composer will add the blueprint packages below here, including the final %end

View File

@ -900,6 +900,31 @@ def compose_args(compose_type):
"app_file": None,
"squashfs_only": False,
},
"liveimg-tar": {"make_iso": False,
"make_disk": False,
"make_fsimage": False,
"make_appliance": False,
"make_ami": False,
"make_tar": True,
"make_tar_disk": False,
"make_pxe_live": False,
"make_ostree_live": False,
"make_oci": False,
"make_vagrant": False,
"ostree": False,
"live_rootfs_keep_size": False,
"live_rootfs_size": 0,
"image_size_align": 0,
"image_type": False, # False instead of None because of TOML
"qemu_args": [],
"image_name": default_image_name("xz", "root.tar"),
"tar_disk_name": None,
"image_only": True,
"app_name": None,
"app_template": None,
"app_file": None,
"squashfs_only": False,
},
"live-iso": {"make_iso": True,
"make_disk": False,
"make_fsimage": False,

View File

@ -12,7 +12,7 @@ CLI="${CLI:-./src/bin/composer-cli}"
rlJournalStart
rlPhaseStartTest "compose types"
rlAssertEquals "lists all supported types" \
"`$CLI compose types | sort | xargs`" "alibaba ami ext4-filesystem google hyper-v live-iso openstack partitioned-disk qcow2 tar vhd vmdk"
"`$CLI compose types | sort | xargs`" "alibaba ami ext4-filesystem google hyper-v live-iso liveimg-tar openstack partitioned-disk qcow2 tar vhd vmdk"
rlPhaseEnd
rlPhaseStartTest "compose start"

View File

@ -874,7 +874,7 @@ class ServerTestCase(unittest.TestCase):
data = json.loads(resp.data)
self.assertNotEqual(data, None)
self.assertEqual(data["status"], False, "Failed to fail to start test compose: %s" % data)
self.assertEqual(data["errors"], [{"id": BAD_COMPOSE_TYPE, "msg": "Invalid compose type (snakes), must be one of ['alibaba', 'ami', 'ext4-filesystem', 'google', 'hyper-v', 'live-iso', 'openstack', 'partitioned-disk', 'qcow2', 'tar', 'vhd', 'vmdk']"}],
self.assertEqual(data["errors"], [{"id": BAD_COMPOSE_TYPE, "msg": "Invalid compose type (snakes), must be one of ['alibaba', 'ami', 'ext4-filesystem', 'google', 'hyper-v', 'live-iso', 'liveimg-tar', 'openstack', 'partitioned-disk', 'qcow2', 'tar', 'vhd', 'vmdk']"}],
"Failed to get errors: %s" % data)
def test_compose_03_status_fail(self):