From e67922c6e8d75ac7a073a577fb65591ef5ee23d1 Mon Sep 17 00:00:00 2001 From: Erwan MAS Date: Sun, 19 Apr 2020 19:34:30 -0400 Subject: [PATCH 1/4] folder /etc/openstack-cluster-installer/live-image-additions - change test existence from -e to -d - fix typo on double-quote --- bin/openstack-cluster-installer-build-live-image | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bin/openstack-cluster-installer-build-live-image b/bin/openstack-cluster-installer-build-live-image index 0ff64c55..fb3fc033 100755 --- a/bin/openstack-cluster-installer-build-live-image +++ b/bin/openstack-cluster-installer-build-live-image @@ -565,8 +565,8 @@ mkdir -p config/includes.chroot/etc/systemd/system/getty@.service.d echo "ExecStart=-/sbin/agetty --autologin root --noclear %I \$TERM" >config/includes.chroot/etc/systemd/system/getty@.service.d/root-autologin.conf # Copy the customization by the user -if [ -e /etc/openstack-cluster-installer/live-image-additions ] ; then - if [ -n ""$(ls /etc/openstack-cluster-installer/live-image-additions) ] ; then +if [ -d /etc/openstack-cluster-installer/live-image-additions ] ; then + if [ -n "$(ls /etc/openstack-cluster-installer/live-image-additions)" ] ; then if [ -r /etc/openstack-cluster-installer/oci-firmware-upgrade-config.json ] ; then mkdir -p config/includes.chroot/etc/oci cp /etc/openstack-cluster-installer/oci-firmware-upgrade-config.json config/includes.chroot/etc/oci/ -- GitLab From 82edabc4030302501e7ba96b76207f0639ec1d6b Mon Sep 17 00:00:00 2001 From: Erwan MAS Date: Sun, 19 Apr 2020 19:56:39 -0400 Subject: [PATCH 2/4] chassis id can be a mac address example https://www.juniper.net/documentation/en_US/junos/topics/reference/command-summary/show-lldp-neighbors-lldp-ex-series.html#jd0e501 we must allow : --- src/report.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/report.php b/src/report.php index 27b6199c..c07ae46e 100644 --- a/src/report.php +++ b/src/report.php @@ -155,7 +155,7 @@ if($n == 0){ $safe_if_switch_hostname = $if_switch_hostname; $if_switchport_name = $iface["switchport_name"]; - $reg = '/^[0-9a-zA-Z-]{1,64}$/'; + $reg = '/^[0-9a-zA-Z:-]{1,64}$/'; if(!preg_match($reg,$if_switchport_name)) die("Switchport name suspicious"); $safe_if_switchport_name = $if_switchport_name; -- GitLab From bf3f3d8734d394573885b2642c30128962665045 Mon Sep 17 00:00:00 2001 From: Erwan MAS Date: Sun, 19 Apr 2020 20:10:07 -0400 Subject: [PATCH 3/4] tests for switchport name are done in 2 locations --- src/report.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/report.php b/src/report.php index c07ae46e..982fed82 100644 --- a/src/report.php +++ b/src/report.php @@ -155,7 +155,7 @@ if($n == 0){ $safe_if_switch_hostname = $if_switch_hostname; $if_switchport_name = $iface["switchport_name"]; - $reg = '/^[0-9a-zA-Z:-]{1,64}$/'; + $reg = '/^[.:0-9a-zA-Z-]{1,64}$/'; if(!preg_match($reg,$if_switchport_name)) die("Switchport name suspicious"); $safe_if_switchport_name = $if_switchport_name; @@ -246,7 +246,7 @@ if($n == 0){ $safe_if_switch_hostname = $if_switch_hostname; $if_switchport_name = $iface["switchport_name"]; - $reg = '/^[.0-9a-zA-Z-]{1,64}$/'; + $reg = '/^[.:0-9a-zA-Z-]{1,64}$/'; if(!preg_match($reg,$if_switchport_name)) die("Switchport name suspicious"); $safe_if_switchport_name = $if_switchport_name; -- GitLab From f2337020bf5beaaa3d0df1c36ebbfadc8eaf097e Mon Sep 17 00:00:00 2001 From: Erwan MAS Date: Mon, 20 Apr 2020 00:13:43 -0400 Subject: [PATCH 4/4] Fix typo double quote fix when product name have multiple spaces --- common/usr/bin/openstack-cluster-installer-agent | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/common/usr/bin/openstack-cluster-installer-agent b/common/usr/bin/openstack-cluster-installer-agent index 33df02c0..b57c52c5 100755 --- a/common/usr/bin/openstack-cluster-installer-agent +++ b/common/usr/bin/openstack-cluster-installer-agent @@ -39,7 +39,7 @@ fi TMPFILE=$(mktemp -t openstack-cluster-installer-agent.XXXXXX) lsblk -b -l -d -J --exclude 2,7,11 >${TMPFILE} TMPFILE2=$(mktemp -t openstack-cluster-installer-agent.XXXXXX) -if [ ""$(cat ${TMPFILE} | wc -l) = "0" ] ; then +if [ "$(cat ${TMPFILE} | wc -l)" = "0" ] ; then # No disk present echo '{ "blockdevices": [ @@ -117,10 +117,10 @@ esac UPGRADE_CONFIG=/etc/oci/oci-firmware-upgrade-config.json if [ -r ${UPGRADE_CONFIG} ] ; then # Spaces in product names are annoying, so we convert them to underscore - PRODUCT_LIST=$(cat ${UPGRADE_CONFIG} | jq -r '. | keys[]' | sed 's/ /_/' | tr '\n' ' ') + PRODUCT_LIST=$(cat ${UPGRADE_CONFIG} | jq -r '. | keys[]' | sed 's/ /_/g' | tr '\n' ' ') for PRODUCT_NAME_TARGET in ${PRODUCT_LIST} ; do # If the current server type matches one of the product names listed in oci-firmware-upgrade-config.json - if [ "${PRODUCT_NAME_TARGET}" = ""$(echo ${PRODUCT_NAME} | sed 's/ /_/') ] ; then + if [ "${PRODUCT_NAME_TARGET}" = "$(echo ${PRODUCT_NAME} | sed 's/ /_/g')" ] ; then # Check if we have an upgrade for the BIOS BIOS_TARGET_VERSION=$(cat ${UPGRADE_CONFIG} | jq -r '.["'"${PRODUCT_NAME}"'"]["BIOS"]["version"]') if [ "${BIOS_TARGET_VERSION}" != "null" ] && dpkg --compare-versions "${BIOS_VERSION}" lt "${BIOS_TARGET_VERSION}" ; then -- GitLab