Make get-image.sh bashate compliant
Make get-image.sh bashate compliant by creating a file in /tmp for the ifcfg temporary file and using the --upload command instead of the --runcommand operation. Change-Id: I4782140e227105f9aa07fb3967665eaaaeeb0cab Partially-implements: blueprint bashate-gate
This commit is contained in:
parent
23a7fa2869
commit
502aff36cd
@ -7,6 +7,7 @@ IMAGE_URL=http://archive.fedoraproject.org/pub/fedora/linux/releases/21/Cloud/Im
|
|||||||
IMAGE=Fedora-Cloud-Base-20141203-21.x86_64.qcow2
|
IMAGE=Fedora-Cloud-Base-20141203-21.x86_64.qcow2
|
||||||
TARGET_DIR=/var/lib/libvirt/images
|
TARGET_DIR=/var/lib/libvirt/images
|
||||||
TARGET=fedora-21-x86_64
|
TARGET=fedora-21-x86_64
|
||||||
|
export LIBGUESTFS_BACKEND=direct
|
||||||
|
|
||||||
if ! [ -f "$IMAGE" ]; then
|
if ! [ -f "$IMAGE" ]; then
|
||||||
echo "Downloading $IMAGE"
|
echo "Downloading $IMAGE"
|
||||||
@ -16,18 +17,25 @@ fi
|
|||||||
echo "Copying $IMAGE to $TARGET"
|
echo "Copying $IMAGE to $TARGET"
|
||||||
cp "$IMAGE" $TARGET_DIR/$TARGET
|
cp "$IMAGE" $TARGET_DIR/$TARGET
|
||||||
|
|
||||||
virt-customize \
|
|
||||||
--add $TARGET_DIR/$TARGET \
|
TMPFILE=$(mktemp /tmp/kolla-ifcfg-eth1.XXXXXXXXXX)
|
||||||
--run-command "cat > /etc/sysconfig/network-scripts/ifcfg-eth1 <<EOF
|
cat > $TMPFILE <<EOF
|
||||||
DEVICE=eth1
|
DEVICE=eth1
|
||||||
BOOTPROTO=none
|
BOOTPROTO=none
|
||||||
ONBOOT=yes
|
ONBOOT=yes
|
||||||
DEFROUTE=no
|
DEFROUTE=no
|
||||||
EOF" \
|
EOF
|
||||||
|
|
||||||
|
|
||||||
|
virt-customize \
|
||||||
|
--add $TARGET_DIR/$TARGET \
|
||||||
|
--upload $TMPFILE:/etc/sysconfig/network-scripts/ifcfg-eth1
|
||||||
|
|
||||||
# SELinux relabeling requires virt-customize to have networking disabled
|
# SELinux relabeling requires virt-customize to have networking disabled
|
||||||
# https://bugzilla.redhat.com/show_bug.cgi?id=1122907
|
# https://bugzilla.redhat.com/show_bug.cgi?id=1122907
|
||||||
virt-customize --add $TARGET_DIR/$TARGET --selinux-relabel --no-network
|
virt-customize --add $TARGET_DIR/$TARGET --selinux-relabel --no-network
|
||||||
|
|
||||||
|
rm -f $TMPFILE
|
||||||
|
|
||||||
echo "Finished building image:"
|
echo "Finished building image:"
|
||||||
ls -l $TARGET_DIR/$TARGET
|
ls -l $TARGET_DIR/$TARGET
|
||||||
|
Loading…
Reference in New Issue
Block a user